I have a teleporter script here:
local Teleport = "PartB" 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.
It works perfectly. But when I hold out a tool and touch the teleporter part, it stops working. I cannot use it anymore. I don't know if others can, I haven't done a multiplayer test yet. Can someone please help? Also, sometimes I come into game and it just doesn't work, even if I did nothing to it. I have to rejoin. I think that's only in Studio though, idk.
The reason is that the tool don't have a humanoid. To fix, use this script: (Just added a thing to make it detect humanoid)
local Teleport = "PartB" function Touch(hit) if hit.Parent:FindFirstChild("Humanoid") then -- Detect the Humanoid 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 local Pos = script.Parent.Parent:findFirstChild(Teleport) hit.Parent:moveTo(Pos.Position) wait(1) script.Parent.Locked = false script.Parent.Parent:findFirstChild(Teleport).Locked = false end end end script.Parent.Touched:connect(Touch)
As to your "doesn't work when joined", I think the reason is that the script's function detected the hit as the Accessory instead of the player. It should be fixed with this script.
What i think is wrong is that you misspelled FindFirstChild it should FindFirstChild and not findFirstChild