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

i'm trying to get half of the players in the server but it wont work?

Asked by
Stea_my 48
3 years ago

i'm trying to grab half of the players and assign those players to the guards team, but it doesnt work for some reason, it showed on my screen that it was working, but on my friend's screen his team was still neutral (this is in a serverscript). any fixes? heres my code:

while wait() do
    if #game:GetService("Players"):GetPlayers() >= 2 then
local allPlayers = game:GetService("Players"):GetPlayers()
local halfPlayers = table.move(allPlayers, 1, math.ceil(#allPlayers/2), 1, {})
    halfPlayers.Team = game.Teams.Guards
    wait(1)
    end
    end
0
im not sure why this is working on your screen? from what i understand the halfPlayers variable is a table and you are adding a team property to it not doing anything with the players ?_? enzotinman1 23 — 3y
0
the halfplayers table should contain all the players that were chosen in it and assigning their team at once, but thats not whats happening and i dont know why, and it working on my screen but not my friend's was the strangest part Stea_my 48 — 3y

Answer this question