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: Step script

Previous Thread :: Next Thread 
powerfultyphlosion is not online. powerfultyphlosion
Joined: 05 Jul 2012
Total Posts: 379
10 Oct 2014 04:06 PM
Is it possible to make a script that counts how many steps you take?
Report Abuse
powerfultyphlosion is not online. powerfultyphlosion
Joined: 05 Jul 2012
Total Posts: 379
10 Oct 2014 04:37 PM
bump
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
10 Oct 2014 04:41 PM
Yes it is
Report Abuse
powerfultyphlosion is not online. powerfultyphlosion
Joined: 05 Jul 2012
Total Posts: 379
10 Oct 2014 04:43 PM
How?
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
10 Oct 2014 04:46 PM
http://wiki.roblox.com/index.php?title=API:Class/Humanoid/Running


Speed = studs per second
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
10 Oct 2014 04:49 PM
You could also check the total distance travelled using an inefficient loop, but that wouldn't count just steps (Would include falling, flinging, driving, etc) so I'll leave that out unless you want it.
Report Abuse
powerfultyphlosion is not online. powerfultyphlosion
Joined: 05 Jul 2012
Total Posts: 379
10 Oct 2014 05:13 PM
I must be really stupid because I still haven't figured this out. Help?
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
10 Oct 2014 05:25 PM
128 pretty much gave you the answer.

something like ..


local numofsteps = 0

while wait(1) do
local newnum = game.Players.LocalPlayer.Character.Humanoid.WalkSpeed
numofsteps = numofsteps + newnum
print(tostring(numofsteps))
end

[[Extremely inefficient lol]]
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
10 Oct 2014 06:09 PM
This could be cleaned up, but after testing, the running event itself only fires when the player starts running, if you pick up speed, the speed change is not counted

Like I said, could be cleaner, but does work.

local player = game.Players.LocalPlayer
local character = player.Character
if not character then
character = player.CharacterAdded:wait()
end

local stopped, steps = true, 0
character.Humanoid.Running:connect(function(speed)
stopped = (speed == 0)
repeat
steps = steps + character.Torso.Velocity.magnitude / 10
wait(0.1)
until stopped
print(steps)
end)
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