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

Why are these RemoteEvent arguments nil? (FE)

Asked by 6 years ago
Edited 6 years ago

ServerScript in SSS:

game.Players.PlayerAdded:Connect(function(Player)
    game.ReplicatedStorage.remoteevents.PlayerAdded:FireAllClients(Player) -- fire remoteevent
    Player:GetPropertyChangedSignal("Team"):Connect(function()
        game.ReplicatedStorage.TeamChanged:FireAllClients(Player.Name, Player.Team)
    end)
end)

localscript

game:GetService('ReplicatedStorage').remoteevents.PlayerAdded.OnClientEvent:Connect(function(player)
    local playerLabel = game.ReplicatedStorage.PlayerLabel:Clone()
    playerLabel.Name = player.Name -- this part is where I get the error saying that `player` is nil
    playerLabel.Text = player.Name
    playerLabel.Parent = script.Parent
    local xBounds = playerLabel.TextBounds.X
    playerLabel.TeamColor.BackgroundColor3 = player.Team.TeamColor.Color
    wait()
    playerLabel.TeamColor.Position = UDim2.new(1, -xBounds-5, 0.3, 0)
end)
game.ReplicatedStorage.TeamChanged.OnClientEvent:Connect(function(name, team)
    local frame = script.Parent:FindFirstChild(name)
    frame.TeamColor.BackgroundColor3 = team.TeamColor.Color
end)
0
Try printing player a line before the one causing you problems, and see what it prints out Trewier 146 — 6y
0
the player name prints in both scripts for some reason creeperhunter76 554 — 6y

Answer this question