Skill realization: summon a monster
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)