local plr = game.Players.LocalPlayer
local button = script.Parent
local debounce = false
local char = plr.Character or plr.CharacterAdded:Wait()

wait(1)

button.MouseButton1Click:Connect(function()
	if debounce == false then
		debounce = true
		local torso = char.Torso
		local rando = math.random(1,3)
		if rando == 1 then
			torso.CFrame = game.Workspace.Spawn.CFrame
		elseif rando == 2 then
			torso.CFrame = game.Workspace.Spawn2.CFrame
		elseif rando == 3 then
			torso.CFrame = game.Workspace.Spawn3.CFrame
		end
	end
end)

When I click the button it usually works but when I spawn in the game and click it within 5 - 10 seconds of respawning the teleport doesn't work and I have to wait.

1 comment

0

I also tried to get rid of the wait(1) on line 6 but that didn't work