Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i change TextColor3 with FE on?

Hello, I have the Problem that when i try to change the TextColor3 of an TextLabel via a Script in the ServerScriptService the Color does not (to the right Color Code) change.

game.ReplicatedStorage.Remotes.GR.OnServerEvent:connect(function(player)
	game.ReplicatedStorage.StatsHolder:WaitForChild(player.Name):WaitForChild("Ready")
	game.ReplicatedStorage.StatsHolder:FindFirstChild(player.Name).Ready.Value = true
	game.StarterGui.Ready.Frame:FindFirstChild(player.Name).TextColor3 = Color3.new(0, 255, 0)
end)

The Color Code i get out of this is 0, 65025, 0

Has anyone here had the same Problem? and how did you fix it?

2 comments

0

Try to use .fromRGB instead of .new at line 4.

0

Thx for that idea iRexBot, but while the Color Code does now get changed to the right Value it does still not show up in the Gui :/

2 answers

The main problem is that when FE is enabled, server scripts can't access the PlayerGui. You need to add remoteevents and then use FireClient()

Well, for FE your scripts will require server handling.

I've encountered the flaw in your code and I'll explain it to you.

There is one thing on roblox called floats, which Lua kind of has built-in with the variable type. Floats go from 0 to 1, meaning they will never pass above 1.

A Color3 consists of three floats, R, G, B (Color3.new(float, float, float)). There is a simple solution for this, which is dividing each int (1-255) by 255.

However, in your code's case, you can simply put 255 as 1, as 255/255 = 1.

game.ReplicatedStorage.Remotes.GR.OnServerEvent:connect(function(player)
    game.ReplicatedStorage.StatsHolder:WaitForChild(player.Name):WaitForChild("Ready")
    game.ReplicatedStorage.StatsHolder:FindFirstChild(player.Name).Ready.Value = true
    game.StarterGui.Ready.Frame:FindFirstChild(player.Name).TextColor3 = Color3.new(0, 1, 0)
end)

Also, you've got another issue. game.StarterGui.Ready.Frame:FindFirstChild(player.Name) I'm not sure this is what you wanted; could you please comment what's under StarterGui and it's descendants?

You should be doing player.PlayerGui.Ready.Frame.

Hope this helps you!

This discussion is preserved as it was. New answers, comments, and votes are closed.