So i have that im developing. So far so good. Basically theres a car and every 30 seconds it drives away and then 20 - 30 seconds later comes back. Theres a pad you have to stand on to get teleported into the car. So far ive managed to make it so if theres a certain amount of people in the car it wont let you use the teleporter. But im struggling to re-enable it after the car returns.
Code:
local Teleport = workspace.TeleportPad2 -- Name of the Part you touch to teleport to the part you are teleporting to (Change all TeleportPads to the name of your Part)
function Touch(hit)
if script.Parent.Locked == false and script.Parent.Parent:FindFirstChild("TeleportPad2").Locked == false then script.Parent.Locked = time script.Parent.Parent:FindFirstChild("TeleportPad2").Locked = true
local pos = script.Parent.Parent:FindFirstChild("TeleportPad2")
hit.Parent:moveTo(workspace.TeleportPoint2.Position) wait(1) script.Parent.Locked = false script.Parent.Parent:FindFirstChild("TeleportPad2").Locked = false end end
script.Parent.Touched:Connect(Touch)
-- Disable Script
local PlayerCounter = game.ReplicatedStorage:WaitForChild("Players2")
PlayerCounter:GetPropertyChangedSignal("Value"):Connect(function()
if PlayerCounter.Value == 10 then
script.Disabled = true
end
end)
local Counter2 = game.ReplicatedStorage:WaitForChild("Counter2")
Counter2:GetPropertyChangedSignal("Value"):Connect(function()
if Counter2.Value == 0 then
script.Disabled = true
end
end)
local Counter = game.ReplicatedStorage:WaitForChild("Counter2")
Counter:GetPropertyChangedSignal("Value"):Connect(function()
if Counter.Value == 0 then
wait(25)
script.Disabled = false
end
end)

2 comments
From the tests I've personally done, disabled scripts only run for more 50 miliseconds after it's disabled. In that case, you're waiting 25 seconds to re-enable it, so it won't give enough time for it to enable again. I might be wrong, but that is what I think it is.
Yes, I dont know if there is a way to disable the pad then re-enabled again without just disabling the script. Its a bit annoying obviously but i might have to do a clone instead so i can then get rid of it and then enable it again by cloning it again. I feel thats probably the only way to do it.