How can I make it so that when an event is fired a player gets an item for a certain time, and if they die they still have it during the time, but at the end of the time the item is removed from their Backpack. If a new player joins during the time limit they get the item too, and the time limit is the same for everybody. I tried explaining this as bet as I can, so can anyone explain to me how I can do this?
Consider using CollectionService to tag items as temporary. While the timer is active, give players the tools you want when they respawn but after you’ve tagged the cloned copy with your temporary tag. When the timer ends, disconnect related events that give out the tools then use GetTagged to get all instances with your temporary tag and destroy them.
How about when a new player joins during the timer?
Check if the timer is active and if it is, connect a CharacterAdded function for them as well that hands them the same tool in this process. Add it to the list of connections to disconnect when the timer ends. It’s essentially doing the same thing as connecting it for players online when the timer starts, except you’re handling a join case rather than an already-in-server case.
I will try this out, thanks for helping!
What would I do after the event is fired?
So I got the CollectionService before the event is fired, and I have defined the variables but how do I give all the players the item after I have cloned it and given it the tag?
game.ReplicatedStorage.ExampleEvent.Event:Connect(function()
end)