Hey guys, I'm currently making a game where a teleport moves you to a train (that's moving). I keep getting an error in the output box.
Script -
--By CommanderStitchz594. --Working Teleport --Make sure the Part to teleport to is in the same group as this Part. --Feel FREE to Copy, Abuse and Covet! local Teleport = "Part2" --Put the name of the Part between the ""s. function Touch(hit) --Indicates that the Part has been Touched. if script.Parent.Locked == false and script.Parent.Parent:findFirstChild(Teleport).Locked == false then script.Parent.Locked = true script.Parent.Parent:findFirstChild(Teleport).Locked = true --Checks Debounce. local Pos = script.Parent.Parent:findFirstChild(Teleport) --Gets the Part to teleport to. hit.Parent:moveTo(Pos.Position) wait(1) script.Parent.Locked = false script.Parent.Parent:findFirstChild(Teleport).Locked = false end end --Takes you there and Ends the Function. script.Parent.Touched:connect(Touch) --Listens out for Touchers.
The Output Box States -
09:27:11.701 - Stack Begin
09:27:11.701 - Script 'Workspace.Part1.Script', Line 7
09:27:11.702 - Stack End
09:27:11.804 - Workspace.Part1.Script:7: attempt to index a nil value
Is there a fix, or is this just impossible for roblox?
Thanks In Advance!
Put Part 2 in workspace, then change line 7 to this: if script.Parent.Locked == false and workspace:FindFirstChild(Teleport).Locked == false then That's what someone wanted to tell you, and used comments instead.