generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Check

Previous Thread :: Next Thread 
ninja900500 is not online. ninja900500
Joined: 27 Sep 2008
Total Posts: 2324
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
zackeryjerrypowers is not online. zackeryjerrypowers
Joined: 01 Aug 2008
Total Posts: 1515
27 May 2013 10:20 PM
game.Workspace["Playername"].Humanoid.Changed:connect()

--Maybe?

~ ∂◊и'₮ サ∆₮∑ ◊и ₮サ∑ ㄅⅰббㄚ ~
Report Abuse
Osyris is not online. 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
ninja900500 is not online. ninja900500
Joined: 27 Sep 2008
Total Posts: 2324
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 is not online. 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
ninja900500 is not online. ninja900500
Joined: 27 Sep 2008
Total Posts: 2324
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
ninja900500 is not online. ninja900500
Joined: 27 Sep 2008
Total Posts: 2324
29 May 2013 08:24 PM
It's broken.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image