This script if for a leaderboard. A remote event is fired in a localscript in a ScreenGui wich gives the gui position. Then, it checks if a player is in a certain team and checks if the table position is already occupied by another player. If so, sets the player's name to that position in the table. After that, it sets the text label's text to the player's name that is in the first position. But, it says that im not setting the text to a string, even tough I am. The error is in line 9 in the server script. Here are the scripts: LocalScript:
game.ReplicatedStorage.LeaderboardEvents.SendGui:FireServer(script.Parent)
ServerScript:
local playersInRouge = {}
game.Players.PlayerAdded:Connect(function(player)
game.ReplicatedStorage.LeaderboardEvents.SendGui.OnServerEvent:Connect(function(player,gui)
if player.TeamColor == "Deep blue" then
if playersInRouge[1] == nil then
table.insert(playersInRouge,1,player.Name)
end
end
gui.Frame.Name1.Text = playersInRouge[1]
end)
end)
I tried using tostring() for playersInRouge[1] but then the text says "nil". I removed the if statement to check in wich team the player is and it worked. But I need to check in wich team the player is.

1 comment
It stopped giving the error but my name still doesn't show up in the textlabel.