The script below will respawn the player and reward them 10 points, but if multiple people hit it at once, it only does it to one person and no one else. Any help?
local respawnInProgress = false
local respawnTime = 0.1
local pointsReward = 10
script.Parent.Touched:Connect(function(hit)
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
if player and not respawnInProgress then
respawnInProgress = true
player.leaderstats.Points.Value = player.leaderstats.Points.Value + pointsReward
player:LoadCharacter()
wait(respawnTime)
respawnInProgress = false
end
end)

4 comments
first of all thats not a really good way at doing it because an exploiter can easily fire that remote and get unlimited cash
you should also send the character and check the magnitude of the character and the part to make sure he's not spamming it
also this won't fix the fact that they dont get respawned either
Then you try to make an answer if you know what you are doing better