Make the gui frame the same colour as the player's team colour

  1. What do you want to achieve? I would Like to transfer the player’s team colour to the gui frame.

  2. What is the issue? screenshot provided.
    image
    The red arrow represents the frame I would like to change with the player’s team colour, no error is seen in the output.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub? I have searched around on various developer hubs and have not found a solution close to it but not what I am looking for, maybe it is my luck.

LocalScript - Client process.

ReceiveTruce.OnClientEvent:Connect(function(localplayer, plr)
	local Frame = game.Players[plr.Name]:WaitForChild("PlayerGui"):WaitForChild("Truce"):WaitForChild("Frame")
	Frame.Visible = true
	
	Frame.Title.Text = plr.Name .. " requests a truce"
	Frame.Colour.BackgroundColor3 = plr.TeamColor -- Here
end)
Frame.Colour.BackgroundColor3 = plr.TeamColor

NOTE: all the server networking works and the player is assigned to a team.

1 Like

Try to add print statements to make sure the line is running.

Also are you referencing the frame correctly? On the photo the name of the ScreenGui is Flag_Options but the code is finding for Truce instead.

1 Like

To change the color of the frame you’d use Frame.Colour.BackgroundColor = plr.TeamColor

1 Like

Maybe try this out?

local Color = plr.Team.TeamColor.Color
local R,G,B

R = Color.R * 255
G = Color.G * 255
B = Color.B * 255

Frame.Colour.BackgroundColor3 = Color3.fromRGB(R,G,B)

Do

Frame.BackgroundColor3 = game.Players.LocalPlayer.TeamColor.Color

Sorry, Robot64 was the first one I tried thanks for your input