Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

What did I do wrong?

Asked by
wjs3456 90
9 years ago

I want to make it so it will kill all the players and set their WalkSpeed to 0 until the round begins. It wont work though.

function respawn(health,walkspeed)
Wait(14)
health=game.Players.Children.Humanoid.Health
game.Players.Children.Humanoid.Health=100
walkspeed = game.Players.Children.Humanoid.WalkSpeed
Wait(10)
game.Players.Children.Humanoid.WalkSpeed=16
end


respawn(0,0)

Thanks

0
You never do anything to affect the Health of any Character. You never do anything to stop the WalkSpeed of any player. You cannot refer to all children like that. BlueTaslem 18071 — 9y
0
You never use the parameters of your function. If you are killing them then setting their WalkSpeed to 0 will do nothing. You do not run this function at an oppurtune time since this will happen immediately -- before any players join. BlueTaslem 18071 — 9y
0
There is another function that runs before it to that starts when the first person enters. If the next one is after it then will it still run before players join? wjs3456 90 — 9y

1 answer

Log in to vote
1
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
9 years ago
for i,v in pairs(game.Players:GetPlayers()) do
    v.Character.Humanoid.Health = 0
end

This loops through all the players and sets their health to 0. You use the same method to change the WalkSpeed.

Ad

Answer this question