Hello,
In my game there is a portal that when you step into it, it gives you a point (referred to as "Ladder Points") and then teleports you away, but in the same second, the player hits the portal 5-10 times which I do not want. Any ideas on how to solve this?
Here is my current script:
local PortalPart = script.Parent
local Spawn = game.Workspace.Spawn
local function onPartTouched(hit)
local PlayerName = hit.Parent.Name
local player = game.Players:FindFirstChild(PlayerName)
local LadderPoints = player.leaderstats:FindFirstChild("Ladder Points")
if player then
player.Character:MoveTo(Spawn.Position)
LadderPoints.Value += 1
end
end
PortalPart.Touched:Connect(onPartTouched)
Thanks In Advance!

2 comments
Thank you for you reply, works perfectly! By the way, I think you forgot an "end" at the end, 1 for the function, and 2 for the if statements.
Oh yeah, sorry for that! If you were able to fix it, feel free to accept my answer!