Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Teleporter works once then doesn't work again, help?

LocalScript: (teleports the player)

local debounce = false
game.ReplicatedStorage.Teleport2.OnClientEvent:Connect(function()
	 if debounce then return end --Stops if debounce is already true
    debounce = true
	wait(0.1)
game.Workspace:WaitForChild(game.Players.LocalPlayer.Name).UpperTorso.CFrame = CFrame.new(-393.213, 8.21, -215.382)

end)

ServerScript: (Fires remoteevent when player touches)


script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid")then
	game.ReplicatedStorage.Teleport:FireClient(game.Players:GetPlayerFromCharacter(hit.Parent))	
	
end
end)

1 comment

0

It works perfectly fine, just it doesn't work again.

1 answer

✓ Accepted answer

It only works once because you forgot to set the debounce to false again.

Add a wait to line 7, and then on line 8, set the debounce back to false

2 comments

0

TYSM

0

I didn't want to figure out how to make another teleport script, thanks sooo much!

This discussion is preserved as it was. New answers, comments, and votes are closed.