The player walks on to a brick(part) and then gets teleported to another brick (part).
How would this work in Lua?
The player walks on to a brick(part) and then gets teleported to another brick (part).
How would this work in Lua?
local part = script.Parent -- put script in part that teleports the player when touched otherwise edit
local teleportTo = game.Workspace.TELEPORTPART -- edit this line. part where player is teleported to
part.Touched:connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
player.Character:MoveTo(teleportTo.Position)
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
9 comments
If he wants an explanation then he can ask and I'll happily answer his questions. The code is pretty straight forward so I'm not going to waste my time to sugar coat it (especially after he "accepted" my answer..
You should not use debounce in this code snippet. It will have a negative side affect if multiple players step on the brick at once. There is no need for it here. You should remove it from your code. -- I have edited your post to remove the debounce.
You're kiding, right?
No, I am correct- you should not us debounce in this situation.
There was never a debounce.
There was, I removed it from your post.
You're my hero. You don't get a cookie though.
Just because the asker has marked the answer as acceptable, even without an explanation, that doesn't mean that anyone else who views the question will understand what is happening.
Then they could ask or find out for themselves. I'm not going to explain how to insert a BasePart and a script into the explorer, that would be redundant.