I have a problem with the addEvent function. I want to create a system where the player gets rewards for every 15 seconds in the arena. the problem is that if a player enters and exits the arena and repeats this action 3 times, he will receive 3 prizes every 15 seconds. I don't know how to kill addevent after player exits. the exit also changes the storage to the one I have in the script, but when the player enters the arena again, the storage is correct and he gets 3 prizes. How to kill an add event after a player leaves the arena? I tried to assign addevent to a variable and do stopevent on this variable, but it doesn't work either. please help
addEvent(StayArena, 15000, player:getId())
function StayArena(playerId)
local player = Player(playerId)
if not player then
return
end
if(player:getStorageValue(60000)) <= 0 then
return
end
-- add reward here
addEvent(StayArena, 15000, playerId)
end
Last edited: