Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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!


local Member = game.Players.LocalPlayer local Target = game.Workspace.Here local Out = game.Workspace.out

function onTouch(hit) workspace.Member.Humanoid:MoveTo(Target.Position, Target) wait(5) workspace.Member.Humanoid:MoveTo(Out.Position, Out) end

script.Parent.Touched:connect(onTouch)


**And yes. The Script is in a LocalPlayer ** The thing is that when the part it's touched. Nothing happengs.

2 answers

✓ Accepted answer

You are welcome.

repeat wait() until game.Players.LocalPlayer.Character
local Member = game.Players.LocalPlayer
local Target = game.Workspace.Here
local Out = game.Workspace.out

game.Workspace.TouchPart.Touched:connect(function(hit)
   Member.Character.Humanoid:MoveTo(Target.Position)
wait(5)
	Member.Character.Humanoid:MoveTo(Out.Position)
end)

1 comment

0

Thanks you SO much!

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

local Member = game.Players.LocalPlayer
local Target = game.Workspace.Here
local Out = game.Workspace.out

function onTouch()
	Member.Character.Torso.CFrame = CFrame.new(Target.Position)
	wait(5)
	Member.Character.Torso.CFrame = CFrame.new(Out.Position)
end

game.Workspace.TouchPart.Touched:connect(onTouch)

This is a LocalScript in StarterGui.

1 comment

0

It works. But I don't want to teleport the player, I want to move him.

This discussion is preserved as it was. New answers, comments, and votes are closed.