Hi, my scoreboard ui is only showing the local player and not the other players. I am using a global script with playeradded and playerremoved.
local Players = game:GetService("Players")
local Teams = game:GetService("Teams")
function CreateProfile(Player)
wait(1.25);
local PlayerID = Player.UserId
local Scoreboard = Player.PlayerGui.Scoreboard
local TeamFrame = Scoreboard.Frame.TeamFrame
local Team = if Player.Team == Teams.Blue then "Blue" else "Red"
local thumbType = Enum.ThumbnailType.HeadShot
local thumbSize = Enum.ThumbnailSize.Size420x420
local content, isReady = Players:GetUserThumbnailAsync(PlayerID, thumbType, thumbSize)
local ImageLabel = Instance.new("ImageLabel")
ImageLabel.Name = PlayerID
ImageLabel.BackgroundTransparency = 1
ImageLabel.Image = content
local UICorner = Instance.new("UICorner")
UICorner.CornerRadius = UDim.new(20, 8)
UICorner.Parent = ImageLabel
local UIStroke = Instance.new("UIStroke")
UIStroke.Color = Color3.fromRGB(255,255,255)
UIStroke.Parent = ImageLabel
ImageLabel.Parent = TeamFrame[Team]
end
function DeleteProfile(Player)
local Scoreboard = Player.PlayerGui.Scoreboard
local TeamFrame = Scoreboard.Frame.TeamFrame
local Team = if Player.Team == Teams.Blue then "Blue" else "Red"
local ProfileFound = if TeamFrame[Team]:FindFirstChild(Player.UserId) then true else false
if not ProfileFound then
warn("ProfileLabel was not found")
return
end
local Profile = TeamFrame[Team][Player.UserId]
Profile:Destroy()
end
Players.PlayerAdded:Connect(CreateProfile)
Players.PlayerRemoving:Connect(DeleteProfile)
I have an idea of why this is happening but I am not sure how to fix it.
local Players = game:GetService("Players")
local Teams = game:GetService("Teams")
function CreateProfile(Player)
wait(1.25);
local PlayerID = Player.UserId
local Scoreboard = Player.PlayerGui.Scoreboard
local TeamFrame = Scoreboard.Frame.TeamFrame
local Team = if Player.Team == Teams.Blue then "Blue" else "Red"
local thumbType = Enum.ThumbnailType.HeadShot
local thumbSize = Enum.ThumbnailSize.Size420x420
local content, isReady = Players:GetUserThumbnailAsync(PlayerID, thumbType, thumbSize)
local ImageLabel = Instance.new("ImageLabel")
ImageLabel.Name = PlayerID
ImageLabel.BackgroundTransparency = 1
ImageLabel.Image = content
local UICorner = Instance.new("UICorner")
UICorner.CornerRadius = UDim.new(20, 8)
UICorner.Parent = ImageLabel
local UIStroke = Instance.new("UIStroke")
UIStroke.Color = Color3.fromRGB(255,255,255)
UIStroke.Parent = ImageLabel
ImageLabel.Parent = TeamFrame[Team]
end
function DeleteProfile(Player)
local Scoreboard = Player.PlayerGui.Scoreboard
local TeamFrame = Scoreboard.Frame.TeamFrame
local Team = if Player.Team == Teams.Blue then "Blue" else "Red"
local ProfileFound = if TeamFrame[Team]:FindFirstChild(Player.UserId) then true else false
if not ProfileFound then
warn("ProfileLabel was not found")
return
end
local Profile = TeamFrame[Team][Player.UserId]
Profile:Destroy()
end
for i,v in pairs(game.Players:GetChildren()) do
CreateProfile(v)
end
function PlayerAdded()
for i,v in pairs(game.Players:GetChildren()) do
CreateProfile(v)
end
end
function PlayerRemoving(Player)
DeleteProfile(Player)
end
Players.PlayerAdded:Connect(CreateProfile)
Players.PlayerRemoving:Connect(PlayerRemoving)
I tried to fix it but it is now updating one screen