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: Running Event

Previous Thread :: Next Thread 
DarkComa is not online. DarkComa
Joined: 01 Apr 2011
Total Posts: 11679
23 Feb 2014 10:20 AM
Okay, my problem here is that I have no idea to make this script apply to all players. I've done game.Players:getchildren(), but I don't know where to go from there...
Thanks in advance

game.Workspace.Player.Humanoid.Running:connect(function(speed)
if speed > 0 then
game.Workspace.Zombie.Humanoid.Walkspeed = 21
else
game.Workspace.Zombie.Humanoid.Walkspeed = 15
end
end)
Report Abuse
DarkComa is not online. DarkComa
Joined: 01 Apr 2011
Total Posts: 11679
23 Feb 2014 10:23 AM
b1
Report Abuse
DarkComa is not online. DarkComa
Joined: 01 Apr 2011
Total Posts: 11679
23 Feb 2014 10:24 AM
b2
Report Abuse
filiptibell is online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
23 Feb 2014 10:25 AM
Is this what you want?

game.Players.PlayerAdded:connect(function(player)
player.Character.Humanoid.Running:connect(function(speed)
if speed > 0 then
game.Workspace.Zombie.Humanoid.Walkspeed = 21
else
game.Workspace.Zombie.Humanoid.Walkspeed = 15
end
end)
end)
Report Abuse
DarkComa is not online. DarkComa
Joined: 01 Apr 2011
Total Posts: 11679
23 Feb 2014 10:33 AM
It doesn't seem to work. There's no output either. :/
Report Abuse
DarkComa is not online. DarkComa
Joined: 01 Apr 2011
Total Posts: 11679
23 Feb 2014 10:36 AM
b3
Report Abuse
Ekkoh is not online. Ekkoh
Joined: 22 Oct 2012
Total Posts: 524
23 Feb 2014 10:37 AM
Try this out.

local Players = Game:GetService("Players")
local Zom = Workspace.Zombie.Humanoid

function PlayerAdded(plr)
plr.CharacterAdded:connect(function(char)
char:WaitForChild("Humanoid").Running:connect(function(speed)
if speed > 0 then
Zom.WalkSpeed = 21
else Zom.WalkSpeed = 15
end
end)
end)
end

for _, plr in pairs(Players:GetPlayers()) do
PlayerAdded(plr)
plr:LoadCharacter()
end

Players.PlayerAdded:connect(PlayerAdded)

"We can walk a million miles, and end up in the sea." - George Ragan aka Johnny 3 Tears
Report Abuse
ToboboT is not online. ToboboT
Joined: 25 Jun 2011
Total Posts: 2385
23 Feb 2014 10:38 AM
umm this will seem as if the player's walkspeed never changes you know that right?

running fire everytime the walkspeed changes I am pretty sure
Report Abuse
Ekkoh is not online. Ekkoh
Joined: 22 Oct 2012
Total Posts: 524
23 Feb 2014 10:38 AM
Nice shirt btw :P

"We can walk a million miles, and end up in the sea." - George Ragan aka Johnny 3 Tears
Report Abuse
currydude is not online. currydude
Joined: 06 Dec 2008
Total Posts: 656
23 Feb 2014 10:38 AM
I don't quite understand what you want to happen here, do you want this script to run for each player?
Report Abuse
DarkComa is not online. DarkComa
Joined: 01 Apr 2011
Total Posts: 11679
23 Feb 2014 10:41 AM
@ekkoh
It doesn't work, but thank you for the shirt compliment. :3
@curry
Yes.
Report Abuse
currydude is not online. currydude
Joined: 06 Dec 2008
Total Posts: 656
23 Feb 2014 10:43 AM
I would put it in a localscript that is copied into the starterpack or somewhere like that (just so it can get to .Character.Humanoid) and then have it run like that.
Report Abuse
DarkComa is not online. DarkComa
Joined: 01 Apr 2011
Total Posts: 11679
23 Feb 2014 10:43 AM
Okay, thanks.
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