Posted this yesterday, I guess I had to be way specific. Im trying to make the Player, Move to an Specified Part, then after 5 seconds Move to other.
when Stepping on a part - Go to other - After 5 seconds - Go back!
01 | <pre class = "brush: lua" > local Member = game.Players.LocalPlayer |
02 | local Target = game.Workspace.Here |
03 | local Out = game.Workspace.out |
04 |
05 | function onTouch(hit) |
06 | workspace.Member.Humanoid:MoveTo(Target.Position, Target) |
07 | wait( 5 ) |
08 | workspace.Member.Humanoid:MoveTo(Out.Position, Out) |
09 | end |
10 |
11 | script.Parent.Touched:connect(onTouch) |
12 | </pre> |
**And yes. The Script is in a LocalPlayer ** The thing is that when the part it's touched. Nothing happengs.
You are welcome.
01 | repeat wait() until game.Players.LocalPlayer.Character |
02 | local Member = game.Players.LocalPlayer |
03 | local Target = game.Workspace.Here |
04 | local Out = game.Workspace.out |
05 |
06 | game.Workspace.TouchPart.Touched:connect( function (hit) |
07 | Member.Character.Humanoid:MoveTo(Target.Position) |
08 | wait( 5 ) |
09 | Member.Character.Humanoid:MoveTo(Out.Position) |
10 | end ) |
You will not be able to move the player by their humanoid so instead you must use their torso because it is the root of the player's body which means it will transfer everything it holds. I also made some other changes because you had many other mistakes in your script that I can't really explain (I'm terrible at explaining so pardon my dust).
01 | local Member = game.Players.LocalPlayer |
02 | local Target = game.Workspace.Here |
03 | local Out = game.Workspace.out |
04 |
05 | function onTouch() |
06 | Member.Character.Torso.CFrame = CFrame.new(Target.Position) |
07 | wait( 5 ) |
08 | Member.Character.Torso.CFrame = CFrame.new(Out.Position) |
09 | end |
10 |
11 | game.Workspace.TouchPart.Touched:connect(onTouch) |
This is a LocalScript in StarterGui.