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

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.

1 answer

Your touched event is triggered based on your player touching something,

script.Parent.Touched:connect(onTouch)

If this is inside of the player then it would fire anytime the player touches anything

Normal script inside the part you want to touch

script.Parent.Touched:connect(function(player)
	if(hit.Parent:findFirstChild("Humanoid")) then
		hit.Parent.Humanoid:MoveTo(Target.Position,Target)
			wait(5.00) 
--instead of waiting why not wait til its finished? up to you
		hit.Parent.Humanoid:MoveTo(Out.Position,Out)
	end
end)

In case you want to use MoveToFinish

http://wiki.roblox.com/index.php?title=API:Class/Humanoid/MoveToFinished

2 comments

0

That din't work at all, Because I can't identify the "Hit" Element.

0

Put player where hit was forgot to change that

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