Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What did I do wrong?

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

3 comments

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.

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.

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?

1 answer

✓ Accepted answer
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.

This discussion is preserved as it was. New answers, comments, and votes are closed.