|
| 12 Apr 2013 08:41 PM |
| Hello, I have been working on a project and require a script. How would I write a script that would change a certain teams walkspeed to a certain value? Thank you. |
|
|
| Report Abuse |
|
|
|
| 12 Apr 2013 09:01 PM |
| I know how to do this.. But this is not a forum to give away scripts, so go read the wiki, and make it yourself :) |
|
|
| Report Abuse |
|
|
|
| 13 Apr 2013 01:23 AM |
c = game.Players:GetChildren()
for i = 1, #c do if c.TeamColor = game.Teams["TEAM NAME HERE"].TeamColor then c[i].Character.Humanoid.WalkSpeed = SPEED HERE end end |
|
|
| Report Abuse |
|
|
|
| 13 Apr 2013 05:01 PM |
| The script does not appear to work for some reason, what is the problem? |
|
|
| Report Abuse |
|
|
|
| 14 Apr 2013 01:44 AM |
Found the error, fixed:
c = game.Players:GetChildren()
for i = 1, #c do if c[i].TeamColor = game.Teams["TEAM NAME HERE"].TeamColor then c[i].Character.Humanoid.WalkSpeed = SPEED HERE end end |
|
|
| Report Abuse |
|
|
|
| 14 Apr 2013 12:04 PM |
| I have tried the fixed script, however there is an error. Studio underlines in red the line for i = 1, #c do. How would we fix this? |
|
|
| Report Abuse |
|
|
|
| 14 Apr 2013 12:10 PM |
| go to the error hover over it and it will tell you what is wrong. |
|
|
| Report Abuse |
|
|
ForceSky
|
  |
| Joined: 30 Jul 2012 |
| Total Posts: 2379 |
|
|
| 14 Apr 2013 12:38 PM |
Here, if you want the walkspeed to be changed when they join, use this:
function onPlayerAdded(plr) if plr.TeamColor == ("TEAMCOLORGOESHERE") then plr.Character.Humanoid.Walkspeed = WALKSPEEDNUMBERGOESHERE end game.Players.ChildAdded:connect(onPlayerAdded) |
|
|
| Report Abuse |
|
|
|
| 14 Apr 2013 01:10 PM |
| What would happen if they spawn on the team with walkspeed 16, then join the slower? Or the other way around? Does this malfunction when I test in studio? |
|
|
| Report Abuse |
|
|
ForceSky
|
  |
| Joined: 30 Jul 2012 |
| Total Posts: 2379 |
|
|
| 14 Apr 2013 06:45 PM |
| Unless teamchange is on, people can't change teams. You could also just set the property when a player changes teams. |
|
|
| Report Abuse |
|
|