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

How do I make a character move with a button?

Asked by 2 years ago
Edited 2 years ago

So, I'm trying to make a script where a character progressively gets closer to the player and eventually killing them. However, I want the player to be able to reset the character by pressing a button. This is the code I have so far.


local SUNFI5H = script.Parent local humanoid = SUNFI5H.Humanoid local button = game.Workspace.door.duckbutton while true do wait(13) humanoid:MoveTo(workspace.waypoints4.d1.Position) humanoid.MoveToFinished:Wait() wait(8) humanoid:MoveTo(workspace.waypoints4.d2.Position) humanoid.MoveToFinished:Wait() wait(8) humanoid:MoveTo(workspace.waypoints4.d3.Position) humanoid.MoveToFinished:Wait() wait(10) humanoid:MoveTo(workspace.waypoints4.d4.Position) humanoid.MoveToFinished:Wait() end button.ClickDetector.MouseClick:Connect(function() humanoid:MoveTo(workspace.waypoints4.d0.Position) humanoid.MoveToFinished:Wait() end)

Answer this question