|
| 27 Jul 2013 02:57 AM |
Why won't this work?
game.Players.PlayerAdded:connect(function(player) player.Character.Humanoid.WalkSpeed = 0 end)
It should be working fine I thought... |
|
|
| Report Abuse |
|
|
777MrEpic
|
  |
| Joined: 17 Oct 2012 |
| Total Posts: 3998 |
|
|
| 27 Jul 2013 02:59 AM |
leastn = 0 function ok(aplayer) aplayer.Character.Humanoid.WalkSpeed = leastn end game.Players.PlayerAdded:connect(ok) |
|
|
| Report Abuse |
|
|
| |
|
noliCAIKS
|
  |
| Joined: 08 Mar 2010 |
| Total Posts: 917 |
|
|
| 27 Jul 2013 04:51 AM |
You're all doing it wrong. I'll write you something neat. |
|
|
| Report Abuse |
|
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
|
| 27 Jul 2013 04:52 AM |
game.Players.PlayerAdded:connect(function(plyr) repeat wait() until plyr.Character plyr.Character.Humanoid.WalkSpeed = 0 end) |
|
|
| Report Abuse |
|
|
noliCAIKS
|
  |
| Joined: 08 Mar 2010 |
| Total Posts: 917 |
|
|
| 27 Jul 2013 04:58 AM |
It's done. Here you go:
local Players = Game:GetService("Players")
function DisableWalking(character) local humanoid = WaitForChildByClass(character, "Humanoid") humanoid.WalkSpeed = 0 end function WaitForChildByClass(parent, typename) for _, child in ipairs(parent:GetChildren()) do if child:IsA(typename) then return child end end local child repeat child = parent.ChildAdded:wait() until child:IsA(typename) return child end
Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(DisableWalking) end) |
|
|
| Report Abuse |
|
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
|
| 27 Jul 2013 04:59 AM |
| Doubt he wanted the player to spawn with 0 WalkSpeed all the time. |
|
|
| Report Abuse |
|
|
noliCAIKS
|
  |
| Joined: 08 Mar 2010 |
| Total Posts: 917 |
|
|
| 27 Jul 2013 05:03 AM |
Ah, if you want it to happen only once, use this:
local Players = Game:GetService("Players")
function DisableWalking(character) local humanoid = WaitForChildByClass(character, "Humanoid") humanoid.WalkSpeed = 0 end function WaitForChildByClass(parent, typename) for _, child in ipairs(parent:GetChildren()) do if child:IsA(typename) then return child end end local child repeat child = parent.ChildAdded:wait() until child:IsA(typename) return child end
Players.PlayerAdded:connect(function(player) DisableWalking(player.CharacterAdded:wait()) end) |
|
|
| Report Abuse |
|
|
sam8985
|
  |
| Joined: 12 Nov 2011 |
| Total Posts: 582 |
|
|
| 27 Jul 2013 05:06 AM |
Or, shorter and simpler: game.Players.PlayerAdded:connect(function(plr) plr:WaitForChild("Character") Character.Humanoid.Walkspeed = 0 end) |
|
|
| Report Abuse |
|
|
noliCAIKS
|
  |
| Joined: 08 Mar 2010 |
| Total Posts: 917 |
|
|
| 27 Jul 2013 05:10 AM |
@sam8985 Character is not a while. Also, that is unreliable. If you want it simple but stable, use this:
Game:GetService("Players").PlayerAdded:connect(function(player) player.CharacterAdded:wait():WaitForChild("Humanoid").Walkspeed = 0 end) |
|
|
| Report Abuse |
|
|
noliCAIKS
|
  |
| Joined: 08 Mar 2010 |
| Total Posts: 917 |
|
|
| 27 Jul 2013 05:11 AM |
| *child, instead of while. What the heck. |
|
|
| Report Abuse |
|
|
iIikeyou
|
  |
| Joined: 07 Mar 2012 |
| Total Posts: 1659 |
|
|
| 27 Jul 2013 05:12 AM |
local function d(o) o.Humanoid.WalkSpeed=0 end game.Players.PlayerAdded:connect(function(p) repeat wait()until p.Character d(p.Character) p.CharacterAdded:connect(d) end) |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2013 02:41 PM |
| Thank you all for the different ideas! I'll try em' out! |
|
|
| Report Abuse |
|
|