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 » Scripters
Home Search
 

Re: Get value of WalkSpeed and JumpPower

Previous Thread :: Next Thread 
XXYOLOSWAGMATT is not online. XXYOLOSWAGMATT
Joined: 12 Feb 2016
Total Posts: 83
06 Aug 2017 05:25 AM
I want to get the value of WalkSpeed and JumpPower as I have a script that sets the players WalkSpeed and JumpPower to 0 then waits two seconds then after I want it to set it back to what the players WalkSpeed and JumpPower was before.

I want to do this using a variable before it gets set to 0 that saves the players current WalkSpeed and JumpPower as different players can have different values for those.
Report Abuse
noahcoolboy2 is not online. noahcoolboy2
Joined: 06 Aug 2016
Total Posts: 459
06 Aug 2017 05:28 AM
ws = game.Players.LocalPlayer.Character.Humanoid.Walkspeed
jp = game.Players.LocalPlayer.Character.Humanoid.JumpPower
game.Players.LocalPlayer.Character.Humanoid.Walkspeed = 0
game.Players.LocalPlayer.Character.Humanoid.JumpPower = 0
wait(2)
game.Players.LocalPlayer.Character.Humanoid.Walkspeed = ws
game.Players.LocalPlayer.Character.Humanoid.JumpPower = jp
Report Abuse
noahcoolboy2 is not online. noahcoolboy2
Joined: 06 Aug 2016
Total Posts: 459
06 Aug 2017 05:29 AM
use localscript to use localplayer or change the path of localplayer to a specific player in workspace
Report Abuse
FleetyPix is online. FleetyPix
Joined: 14 Jan 2017
Total Posts: 45
06 Aug 2017 05:31 AM
OR you can do this

Player = "JuliusColeChocolateHater"

WS = game.Players[Player].Humanoid.WalkSpeed
JP = game.Players[Player].Humanoid.JumpPower
Report Abuse
noahcoolboy2 is not online. noahcoolboy2
Joined: 06 Aug 2016
Total Posts: 459
06 Aug 2017 05:32 AM
right
Report Abuse
FleetyPix is online. FleetyPix
Joined: 14 Jan 2017
Total Posts: 45
06 Aug 2017 05:35 AM
Whoops! I mean

Player = "JuliusColeChocolateHater"

WS = game.Players[Player].Character.Humanoid.WalkSpeed
JP = game.Players[Player].Character.Humanoid.JumpPower
Report Abuse
XXYOLOSWAGMATT is not online. XXYOLOSWAGMATT
Joined: 12 Feb 2016
Total Posts: 83
06 Aug 2017 07:41 AM
It works fine but as this script is activated by a touch event I had to get the player. I'm just wondering how I could stop this error: "attempt to index local 'player' (a nil value)".
Report Abuse
Kaboom680 is not online. Kaboom680
Joined: 09 Feb 2009
Total Posts: 384
06 Aug 2017 04:41 PM
why would you need to get the player rofl

local hitUnits = {}

local waitDuration = 2
local cooldown = 2

local hitUnits = {}

local waitDuration = 2
local cooldown = 2

#script.Parent.Touched:--[[im putting this comment here because this gets censored for some reason. remove if needed]]connect(function(hit)
local humanoid = hit.Parent and hit.Parent:FindFirstChild("Humanoid")
if humanoid then
for i, units in pairs(hitUnits) do
if units == humanoid.Parent then
return
end
end


hitUnits[#hitUnits + 1] = humanoid.Parent

local WS, JS = humanoid.WalkSpeed, humanoid.JumpPower

humanoid.WalkSpeed, humanoid.JumpPower = 0,0

wait(waitDuration)

humanoid.WalkSpeed,humanoid.JumpPower = WS, JS

wait(cooldown)

for i, units in pairs(hitUnits) do
if units == humanoid.Parent then
table.remove(hitUnits, i)
end
end
end
end)


okay so i just made a script for you because im was bored.
waitDuration is how long they're unable to move, cooldown is how long they can touch the object after it stops you and not be stopped again.

basically all of the stuff that seems odd about it is to make sure it doesn't affect a humanoid that it already has affected.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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