Create Portal

Click here to participate in creation and interaction!
Create

Skill realization: summon a monster

2022.03.31 241 1
Share

Code:   Client script: local function MonsterspawnRequests(mosterId)  PackageHandlers.sendClientHandler("MonsteSpawn",{mosterId}, function()      print("A monster build request has been sent")  end) end summonBar.Moster_1.onMouseClick = function(instance, window)  if(gold>=monstersButtons[1].cost) then    gold=gold-monstersButtons[1].cost    goldText:setText("Gold:"..gold)    MonsterspawnRequests(monstersButtons[1].id)  end   end Server-side script: PackageHandlers.registerServerHandler("MonsteSpawn", function(player, parameter)    local mosterId=parameter[1]    print("Request accepted and monster generated:",parameter[1])    local pos    if(player:getRebirthPos().x>0) then      pos = Lib.v3(math.random(-5,-2),0,math.random(-10,10))+player:getRebirthPos()    else     pos = Lib.v3(math.random(2,5),0,math.random(-10,10))+player:getRebirthPos()     end    local entity= player:createPet(mosterId, true, player.map, pos) end)

Reply

You have the same problem?

CANCEL SEND OUT

Post report

Please select the report type*

Please fill in the reason for reporting*

CANCEL SEND OUT