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

Script doesn't disable teleport pad for a specific amount of time, how do i fix?

I'm trying to make a script that disables a teleport pad, waits a bit, than re-enables it (over and over again) Kinda like the games where you queue and join. Here is the script.

wait(60)
script.disabled=true
wait(5)
script.disabled=false

script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid') then
hit.Parent.Head.CFrame = CFrame.new(65, 12, 20)
end
end)

yes, i know script.disabled stops the script, but I'm not a great scripter.

1 comment

0

Try putting in a while loop.

1 answer

You can add a debounce, and I recommend teleporting the torso or humanoidrootpart instead of the head.

local WaitTime = 60 --Change this to any value you like
local debounce = false --False means not activated, True means activated

script.Parent.Touched:connect(function(hit)
	if not debounce then --Alternative: if debounce == false
	debounce = true
	if hit.Parent:FindFirstChild("Humanoid") then
		hit.Parent.HumanoidRootPart.CFrame = CFrame.new(65, 12, 20) --Change humanoid root part to torso if you're using R6
	end
	wait(WaitTime)
	debounce = false
	end
end)

1 comment

0

This should work yeah

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