#please help

1 messages · Page 1 of 1 (latest)

long thorn
#

heres client (local script)

local rs = game:GetService("ReplicatedStorage")
local Events = rs:WaitForChild("Events")
local TestingCommands = rs.Events:FindFirstChild("TestingCommands")

local function GetChosenPlayer()
    local players = Players:GetPlayers()
    if #players < 2 then
        return nil
    end
    return players[math.random(1, #players)]
end


for i = 20, 0, -1 do
    if #Players:GetPlayers() < 2 then return end
    script.Parent.Text = i .. " till the game starts"
    task.wait(1)
end


script.Parent.Text = "Starting..."
task.wait(2)


local chosenPlayer = nil
repeat
    chosenPlayer = GetChosenPlayer()
    task.wait(0.5)
until chosenPlayer ~= nil

if chosenPlayer then
    print("Chosen player:", chosenPlayer.Name)
    Events.GetRandomPlayerAndCreateCharacters:FireServer(chosenPlayer)
else
    warn("Not enough players")
end```
heres server script (script)
```local rs = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local events = rs:WaitForChild("Events")





events.GetRandomPlayerAndCreateCharacters.OnServerEvent:Connect(function(no,player)
    print(player.Name)
    
    
    

    local rig = workspace:FindFirstChild("Manger1")
    local humanoid = rig:FindFirstChild("Humanoid")

    local description = Players:GetHumanoidDescriptionFromUserId(player.UserId)
    
    humanoid:ApplyDescription(description)

    rig.Name = player.Name
end)

output just says that user id got nil and description wont load helppppp