So me and my friend are working on a game but he made the teleporters and they don't work. Sorry about the account, don't judge me lol I forgot my password and email. My main is FNTHarm

There are no errors.

Here is the code

Teleport 1

local Teleport = "Part1"
function Touch(hit) 
	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 
script.Parent.Touched:connect(Touch) 

Teleport 2

local Teleport = "Part2" 
function Touch(hit) 
	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 
script.Parent.Touched:connect(Touch) 

3 comments

0

it starts to break when multiple people start using it

0

Could you explain why you're locking the parts? I know the problem (if another part touches the TP brick in the 1 second time window induced by wait() the if won't be true and won't trigger) but it's hard to provide a solution for because I don't know the purpose behind locking the 2 parts.

0

I found my main account. I am not sure why the parts are locked, my friend Greatfuis made the script. So should i get rid of the locked part? or do ihave to get all the bricks away from the teleport