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
|
  |
| 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 |
|
|
|
| 21 Jun 2014 10:54 AM |
repeat wait() until game.Players.LocalPlayer.Humanoid script.Parent.Parent.Character.Humanoid.Walkspeed = --Value |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 21 Jun 2014 11:20 AM |
"@ above you don't need ; in lua."
i know.
|
|
|
| Report Abuse |
|
|
|
| 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 |
|
|