Problem with teleporting

I am making a game, similar to a speedrunning game where you try to beat the record.
I was using teleporters to teleport to the other pad. Pad one, and pad two.

Here is both of the pads scripts.

local Teleport = "ToMoon"
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(2)script.Parent.Locked = false script.Parent.Parent:FindFirstChild(Teleport).Locked = false
	    end
	       end
	script.Parent.Touched:connect(Touch)

The name of the one above is “ToEarth”
And the name of the one below is “ToMoon”

local Teleport = "ToEarth"
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)

They work for a while, but then when you try after a while with a friend it just stops working. Please help,

Thanks.

Are there any errors which show up

Does it throw any errors? or just stop working?

Isn’t “moveTo” supposed to be “MoveTo”
You can check script errors at the top of your screen while you’re scripting

must verify that hit belongs to a player.

function Touch(hit)
    if script.Parent.Locked == false and script.Parent.Parent:FindFirstChild(Teleport).Locked == false then
        if hit.parent and game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) 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(2)
            script.Parent.Locked = false
            script.Parent.Parent:FindFirstChild(Teleport).Locked = false
        end
    end
end

Also, remember that, thanks to wait(2), after someone has teleported, no one else can do so for the next two seconds. maybe you should remove it.

Is there a way to make wait(2) only for the people who use it?