Why is the ColorScript not changing the color properly?


Achieve

I’m making a script that will change the color of everything in the U.I to a certain color for each item.


Issue

The issue is that the color changes to complete black and I have no idea why. You’ll see more down in the photos.


Solutions

  • I’ve tried changing the Color3 values to BrickColorValues
  • I’ve tried changing the fromRGB to new & FromHSV and the result was the same.

Photos

What Happens

image

What's supposed to happen

image

Values

BackgroundColor

image

ButtonColor

image

ButtonTextColor

image

OutlineColor

image

Where the Values & Script are at.

image


Script

--//By MillerrIAm\\--
--/Variables\--
local MainUI = script.Parent.Parent
local Colors = script.Parent
--/Main Code\--
while script.Disabled == false do
	wait(0.5)
	for x,UI in pairs (MainUI:GetChildren()) do
		if UI:IsA("Frame") then
			UI.BackgroundColor3 = Color3.fromRGB(Colors.BackgroundColor.Value)
			UI.BorderColor3 = Color3.fromRGB(Colors.OutlineColor.Value)
			wait(0.05)
		elseif UI:IsA("TextButton") then
			UI.BackgroundColor3 = Color3.fromRGB(Colors.ButtonColor.Value)
			UI.TextColor3 = Color3.fromRGB(Colors.ButtonTextColor.Value)
			wait(0.05)
		end
	end
end

Thank you for any help you can give me.

1 Like

May I ask why you are using a server script in StarterGui?

When trying to set the values for changing color from a Color3Value do not use Color3.fromRGB. You use only the value from it since it’s already in Color3.

2 Likes

I use a Server Script for a few reasons…

  • To prevent exploiters from changing the code and messing with the game.
  • The ServerScript can do more of what I need it to do.
  • A personal preference.

I always thought server scripts could not run in Player GUIs ever since FE has been forced, as said here.

1 Like

It all just depends on how it’s used, for example… changing the color of your U.I any script could do… however you couldn’t get any data from the local side to make a server change while using a Server Script.