|
| 19 Nov 2017 04:46 PM |
| Hi guys. This is my script for a moving NPC. Its just the animation doesnt stop. could you add onto this script and reply with the same script just with the animation stopping after he walks the distance? Here is the script: local Npc = script.Parent local human = script.parent:FindFirstChild("Humanoid") local animation = Instance.new("Animation") animation.AnimationId = ########################################### local anim1 = human:LoadAnimation(animation) local distance = 0.5 local walkspeed = .003 Npc.PrimaryPart = Npc:WaitForChild("UpperTorso") anim1:Play() for i = .005, distance, walkspeed do wait(.01) Npc:SetPrimaryPartCFrame(Npc:GetPrimaryPartCFrame() * CFrame.new(0,0,-i)) end |
|
|
| Report Abuse |
|
|
|
| 19 Nov 2017 04:47 PM |
| the local Npc = script.Parent local human = script.parent:FindFirstChild("Humanoid") local animation = Instance.new("Animation") animation.AnimationId = ################################# local anim1 = human:LoadAnimation(animation) local distance = 0.5 local walkspeed = .003 Npc.PrimaryPart = Npc:WaitForChild("UpperTorso") anim1:Play() for i = .005, distance, walkspeed do wait(.01) Npc:SetPrimaryPartCFrame(Npc:GetPrimaryPartCFrame() * CFrame.new(0,0,-i)) end |
|
|
| Report Abuse |
|
|
dialza
|
  |
| Joined: 12 Mar 2016 |
| Total Posts: 211 |
|
|
| 19 Nov 2017 04:48 PM |
anim1:Stop() should stop it
~my replies might be slow due to the posting cooldown but pm me if you want further elaboration |
|
|
| Report Abuse |
|
|
|
| 19 Nov 2017 04:57 PM |
| When i do that the NPC just walks without the animation |
|
|
| Report Abuse |
|
|
dialza
|
  |
| Joined: 12 Mar 2016 |
| Total Posts: 211 |
|
|
| 19 Nov 2017 04:59 PM |
make sure anim1:Play() runs when walking, and anim1:Stop() runs when not walking
~my replies might be slow due to the posting cooldown. PM me if you want further elaboration as i may abandon threads |
|
|
| Report Abuse |
|
|
|
| 19 Nov 2017 05:01 PM |
ok could you copy my script and put those things into it cuz idk what you mean
|
|
|
| Report Abuse |
|
|
dialza
|
  |
| Joined: 12 Mar 2016 |
| Total Posts: 211 |
|
|
| 19 Nov 2017 05:03 PM |
add something that checks whether the player is walking, then make a line of code to play and stop the animation based on that i can't really add it myself because i can't tell what's going on in that it's messy
~my replies might be slow due to the posting cooldown. PM me if you want further elaboration as i may abandon threads |
|
|
| Report Abuse |
|
|