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: How to change player's walkspeed upon entry?

Previous Thread :: Next Thread 
Typocrite is not online. Typocrite
Joined: 28 Aug 2013
Total Posts: 6856
21 Jun 2014 10:52 AM
Not concerned about the function part or changing the walkspeed itself- I know how to do that.

It's just: how do I get from localplayer to their character (torso?)
Report Abuse
DataStore is not online. DataStore
Joined: 07 Feb 2012
Total Posts: 8540
21 Jun 2014 10:53 AM
You can do this from a server-side script using PlayerAdded and CharacterAdded. If you do wish to do it from a LocalScript, which I personally wouldn't, you can get the player's character by doing:

game.Players.LocalPlayer.Character

Report Abuse
Meowcatmaster is not online. Meowcatmaster
Joined: 20 Oct 2012
Total Posts: 769
21 Jun 2014 10:54 AM
repeat wait() until game.Players.LocalPlayer.Humanoid
script.Parent.Parent.Character.Humanoid.Walkspeed = --Value
Report Abuse
Doobadooba123 is not online. Doobadooba123
Joined: 09 May 2012
Total Posts: 18
21 Jun 2014 11:06 AM
Players.LocalPlayer.Character.Humanoid.WalkSpeed = 150
Tips=Use LocalScript or in wont work just hit right mouse click then hit Advanched Objects. Search LocalScript and Write the script in it and you're Done!
Report Abuse
VerifiedName is not online. VerifiedName
Joined: 26 Jul 2009
Total Posts: 4534
21 Jun 2014 11:14 AM
local speedToChangeTo = 32; -- change

script.Parent.Touched:connect(function(hit)
local human = hit.Parent:findFirstChild('Humanoid');
if human ~= nil then
human.WalkSpeed = speedToChangeTo;
end
end)

Report Abuse
VerifiedName is not online. VerifiedName
Joined: 26 Jul 2009
Total Posts: 4534
21 Jun 2014 11:16 AM
wait, copied wrong script .-. derp

local speedToChangeTo = 32; -- change

game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(char)
if char:findFirstChild('Humanoid') then
char.Humanoid.WalkSpeed = speedToChangeTo;
end
end)
end)

Report Abuse
calebpwns1002 is not online. calebpwns1002
Joined: 29 Mar 2013
Total Posts: 521
21 Jun 2014 11:19 AM
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(char)
if char:findFirstChild('Humanoid') then
char.Humanoid.WalkSpeed = 11 -- speed ya want
end
end)
end)

@ above you don't need ; in lua.
Report Abuse
VerifiedName is not online. VerifiedName
Joined: 26 Jul 2009
Total Posts: 4534
21 Jun 2014 11:20 AM
"@ above you don't need ; in lua."

i know.

Report Abuse
SuperiorEternal is not online. SuperiorEternal
Joined: 22 Aug 2009
Total Posts: 2365
21 Jun 2014 12:11 PM
game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(chr)
chr.Humanoid.WalkSpeed = 50
end)
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