Hello, what I'm trying to do is create a jail tool. When the handle of the tool touches a player, he'll be moved to a specific part. The problem for this was that it kept putting the person in jail. I tried to put a Bool Value called "Arrest" that turns true if it touches someone. After eight seconds, it'll be false. What this does is that if the Bool Value is true then it won't teleport, but if it's false, then it'll teleport. The problem is that it won't work because the BoolValue is always staying at true and never turning false.
tool = script.Parent
Arrest = script.Parent.Arrest
function touch(hit)
h = hit.Parent
g = h:findFirstChild("Humanoid")
if Arrest.Value == false then
Arrest.Value = true
elseif Arrest.Value == true then
Arrest.Value = false
if g ~= nil then
if g.Health > 0 then
h:MoveTo(game.workspace.Jail.Position)
wait(8)
Arrest.Value = false
end
end
end
end
function sel()
tool.Handle.Touched:connect(touch)
end
tool.Equipped:connect(sel)

1 comment
Are there any errors?