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

It doesn't make all player's speed back to 16, some players are still not able to move?

Asked by 6 years ago
Edited 6 years ago

So, This makes all player's Walkspeeds to 0 (so that they cannot move) then after 1 second makes their speed back to normal (so that they can move), but It doesn't make all player's speed back to 16, some players are still not able to move. Help me fix this?

local Players = game.Players:GetPlayers()
for i = 1, #Players do
Players[i].Character.Humanoid.WalkSpeed = 0
wait(1)
Players[i].Character.Humanoid.WalkSpeed = 16
0
Try using GetChildren. LukeGabrieI 73 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago

Well, first you should of set a new variable "numplayers" For an examp. "local numPlayers = game.Players.NumPlayers" for number of players. Here you go.

wait(3)--Set a wait time just for safety measures lol
local numPlayers = game.Players.NumPlayers --Numbers of players on the server
local Players = game.Players:GetPlayers()
for i = numPlayers, #Players do--Since i = numPlayers, it sets speed of how much people are on the server and not little bit of people and the rest not.
Players[i].Character.Humanoid.WalkSpeed = 0-- Speed is set of number of people on server
wait(1)
Players[i].Character.Humanoid.WalkSpeed = 16-- Speed is set of number of people on server
end

--You can thank me IIApexGamerII, please accept if it works. (Then you can delete all these "--")

P.S. Please accept if it works, I would truly love to be accept.

0
If it works on studio and not in the real game, that is what my work partner is going through rn, since it's a "Local" script. IIApexGamerII 76 — 6y
0
NumPlayers is deprecated. It's now #game.Players:GetPlayers() Thundermaker300 554 — 6y
Ad

Answer this question