Hello, thank you for reading. What I'm trying to do is make a door -- which is a brick -- where if you pass through a door, and a BoolValue that you hold, named "Solitary", is true then you will be teleported back to the Jail Position.
The BoolValue "Solitary" is inside another Value called "slots" and "slots" is in another value called playerstats.
h = hit.Parent print(h.Name) if h then if h == nil then return end if h:FindFirstChild("playerstats").slots.Solitary.Value == nil then return end if h:FindFirstChild("playerstats").slots.Solitary.Value == true then h:MoveTo(game.Workspace.Jail.Position) end end end script.Parent.Touched:connect(onTouched)
function onTouched(hit) if hit.Parent:FindFirstChild("Humanoid") then local solitary = h.Parent.slots:FindFirstChild("Solitary") if solitary then if solitary.Value then h.Parent:MoveTo(game.Workspace.Jail.Position) end end end end script.Parent.Touched:connect(onTouched)
Hope this helped!
Sincerely, jmanrock123