|
| 27 May 2013 10:13 PM |
| What would I want to use if I want my script to constantly check my player's speed? For example, I want this animation to run when my speed is 0 and this one to run when my speed is 5. What would I use? Please help. Thanks. |
|
|
| Report Abuse |
|
|
|
| 27 May 2013 10:20 PM |
game.Workspace["Playername"].Humanoid.Changed:connect()
--Maybe?
~ ∂◊и'₮ サ∆₮∑ ◊и ₮サ∑ ㄅⅰббㄚ ~ |
|
|
| Report Abuse |
|
|
Osyris
|
  |
| Joined: 27 Oct 2007 |
| Total Posts: 4321 |
|
|
| 27 May 2013 10:20 PM |
Basically you need to fetch the Humanoid first. I'll do this through LocalPlayer (in this case it must be a LocalScript)
repeat wait() until pcall(function() --yay for whatever game:service'Players'.LocalPlayer.Character.Humanoid.Running:connect(function(Speed) if Speed>0 then --Running Code else --Not Running Code end end) end) |
|
|
| Report Abuse |
|
|
|
| 27 May 2013 10:40 PM |
This won't work. Please help:
repeat wait() until pcall(function() game:service'Players'.LocalPlayer.Character.Humanoid.Running:connect(function(Speed) if Speed == 0 and aiming == true or aiming == false or Speed == 5 and aiming == true then wait () for i = 1, 2 do repeat for FT = 1, 40 do welds[1].C0 = welds[1].C0 + Vector3.new(0, -0.001, 0) welds[2].C0 = welds[2].C0 + Vector3.new(0, -0.001, 0) welds[3].C0 = welds[3].C0 + Vector3.new(0, -0.001, 0) welds[4].C0 = welds[4].C0 + Vector3.new(0, -0.001, 0) wait(0.05) end for ST = 1, 40 do welds[1].C0 = welds[1].C0 + Vector3.new(0, 0.001, 0) welds[2].C0 = welds[2].C0 + Vector3.new(0, 0.001, 0) welds[3].C0 = welds[3].C0 + Vector3.new(0, 0.001, 0) welds[4].C0 = welds[4].C0 + Vector3.new(0, 0.001, 0) wait (0.05) end until i == 3 print ("wut") end end end) end) |
|
|
| Report Abuse |
|
|
Osyris
|
  |
| Joined: 27 Oct 2007 |
| Total Posts: 4321 |
|
|
| 27 May 2013 10:45 PM |
Sorry, I should probably mention that the Running event fires many times. You may need to do something like
repeat wait() until pcall(function() Humanoid=game:service'Players'.LocalPlayer.Character.Humanoid end) Run=function(bool) Running=bool if bool then --Running Code else --Not Running Code end end Humanoid.Running:connect(function(Speed) if Speed>0 and not Running then Run(true) elseif Running then Run(false) end end) |
|
|
| Report Abuse |
|
|
|
| 29 May 2013 08:15 PM |
Humanoid = game.Players[script.Parent.Parent.Parent.Name].Character["Humanoid"] Running_Value =Instance.new("BoolValue") Running_Value.Name='Running' Running_Value.Parent = Humanoid Running_Value.Value=false Running_Event = Humanoid.Running:connect(function(Speed) if Speed > 0 then Running_Value.Value=true else Running_Value.Value=false end end)
function Dur() rw=game.Players[script.Parent.Parent.Parent.Name].Character["Humanoid"] if rw ~= nil and rw:FindFirstChild ("Running") ~= nil and rw.Running_Value.Value == true then print ("Running!") else print ("Walking!") end end |
|
|
| Report Abuse |
|
|
| |
|