i don't know why but it just says that player that is selected is a nil
client (local script)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local events = ReplicatedStorage:FindFirstChild("Events")
local player = Players.LocalPlayer
local function GetPlayerCount()
local PlayerList = Players:GetPlayers()
return #PlayerList
end
local function WriteText()
for i=0,5,1 do
if GetPlayerCount() <= 1 then
script.Parent.Text = "Starting in "..5-i
task.wait(1)
end
end
end
WriteText()
events:FindFirstChild("SkinLoaderManager"):FireServer()
server (script)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local events = ReplicatedStorage:FindFirstChild("Events")
task.wait(3)
local playerList = players:GetPlayers()
print(#playerList)
local function GetRandomPlayer()
local playerList = players:GetPlayers()
if #playerList <= 1 then
return nil
end
local randomIndex = math.random(1, #playerList)
return playerList[randomIndex]
end
events:FindFirstChild("SkinLoaderManager").OnServerEvent:Connect(function()
local randomPlayer = GetRandomPlayer()
local noob = game.Workspace:FindFirstChild("Noob")
local description = players:GetHumanoidDescriptionFromUserIdAsync(randomPlayer.UserId)
noob:WaitForChild("Humanoid"):ApplyDescriptionAsync(description)
end)
description just won't apply help