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

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

Asked by 7 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!


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

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

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

0
That din't work at all, Because I can't identify the "Hit" Element. PalomonCP 15 — 7y
0
Put player where hit was forgot to change that TheRealJ3ffrey 5 — 7y
Ad

Answer this question