In the following script, whenever I call the function "updateClass" only the textLabel.Text value gets changed, therefore, I have to call the function twice (as shown in line 15) in order for the function to change both textLabel.Text and textLabel.BackgroundColor3. This feels counterintuitive and I was wondering if I'm doing something wrong or if this is as good as it can get. If additional clarification is needed, please don't hesitate to tell me. All help is appreciated!
local Players = game:GetService("Players")
local player = Players.LocalPlayer or Players:GetPropertyChangedSignal("LocalPlayer"):wait()
local class = game.ReplicatedStorage:WaitForChild(player.Name):WaitForChild("Class")
local classColor = game.ReplicatedStorage:WaitForChild(player.Name):WaitForChild("CColor")
local textLabel = script.Parent
local function updateClass()
textLabel.Text = class.Value
textLabel.BackgroundColor3 = classColor.Value
end
updateClass()
class.Changed:Connect(updateClass)
classColor.Changed:Connect(updateClass)

1 comment
This worked, thank you so much!