Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How can I make the LocalPlayer go to an Part when stepping on other???

Asked by 8 years ago

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
02local Target = game.Workspace.Here
03local Out = game.Workspace.out
04 
05function onTouch(hit)
06    workspace.Member.Humanoid:MoveTo(Target.Position, Target)
07    wait(5)
08    workspace.Member.Humanoid:MoveTo(Out.Position, Out)
09end
10 
11script.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.

2 answers

Log in to vote
-1
Answered by 8 years ago

You are welcome.

01repeat wait() until game.Players.LocalPlayer.Character
02local Member = game.Players.LocalPlayer
03local Target = game.Workspace.Here
04local Out = game.Workspace.out
05 
06game.Workspace.TouchPart.Touched:connect(function(hit)
07   Member.Character.Humanoid:MoveTo(Target.Position)
08wait(5)
09    Member.Character.Humanoid:MoveTo(Out.Position)
10end)
0
Thanks you SO much! PalomonCP 15 — 8y
Ad
Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

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).

01local Member = game.Players.LocalPlayer
02local Target = game.Workspace.Here
03local Out = game.Workspace.out
04 
05function onTouch()
06    Member.Character.Torso.CFrame = CFrame.new(Target.Position)
07    wait(5)
08    Member.Character.Torso.CFrame = CFrame.new(Out.Position)
09end
10 
11game.Workspace.TouchPart.Touched:connect(onTouch)

This is a LocalScript in StarterGui.

0
It works. But I don't want to teleport the player, I want to move him. PalomonCP 15 — 8y

Answer this question