So I have a server script in server script service that's basically a round script.
What it does is like every other round script but when it chooses a random map it enables the script by doing scriptName.Disabled = false and when the round ends it sets it to true.
This works on all maps and every script works when it's enabled.
However I have issues with 1 script:
local players = game.Players:GetPlayers()
local replicatedStorage = game:GetService("ReplicatedStorage")
local remote = replicatedStorage:WaitForChild("RemoteHide")
local itLabel = replicatedStorage:WaitForChild("BillboardHide")
local it = nil
math.randomseed(tick())
local randomNum = math.random(1, #players)
print("random number is: "..randomNum)
for i, v in pairs(players) do
if i == randomNum then
local text = v.Name
it = v
remote:FireAllClients(text, it)
itLabel:Clone().Parent = it.Character.Head
end
end
In this script it chooses the same random number and that number is ALWAYS the same as number of players so basically it always chooses the last person who joined.
Why does it happen and how can I fix it to really be random without changing anything in the round script?
