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

Why is this code not working? im trying to change the color of it but it wont work.

game.ReplicatedStorage.ColorChange.OnServerEvent:Connect(function(plr)
	
	local char = plr.Character
	local r = plr.PlayerGui.RaceSelector.Menu.SliderMenu.ColorBoxes.ImageColor3 
	local q = Color3.fromRGB(r)
	char["Body Colors"].HeadColor3 = q
	char["Body Colors"].LeftArmColor3 = q
	char["Body Colors"].LeftLegColor3 = q
	--
	char["Body Colors"].RightArmColor3 = q
	char["Body Colors"].RightLegColor3 = q
	char["Body Colors"].TorsoColor3 = q
	print("Changed")
end)

When i do this the color changes but not to the image color of the gui it just turns black, how would i be able to make it work

6 comments

0

im changing a body part

0

I don't believe you need to convert 'r' to RGB (q), you can just directly set the Body Colors equal to 'r'

0

but the r = the imagecolor and where i need to get it from.

0

local color = plr.PlayerGui.RaceSelector.Menu.SliderMenu.ColorBoxes.ImageColor3 char.HeadColor3 = color

0

It doesn't matter if its a backgroundcolor3, an imagecolor3, or a part color, it all still uses the same inputs.

0

i did use that but it doesent work

1 answer

you should make 2 separate scripts, a localscript and a script.

local script:

game.ReplicatedStorage.ColorChange.OnServerEvent:Connect(function(plr)
    local char = plr.Character
    local r = plr.PlayerGui.RaceSelector.Menu.SliderMenu.ColorBoxes.ImageColor3 
    local q = Color3.fromRGB(r)
end)

script:

game.ReplicatedStorage.ColorChange.OnServerEvent:Connect(function(plr)
	char["Body Colors"].HeadColor3 = q
	char["Body Colors"].LeftArmColor3 = q
	char["Body Colors"].LeftLegColor3 = q\
	char["Body Colors"].RightArmColor3 = q
	char["Body Colors"].RightLegColor3 = q
	char["Body Colors"].TorsoColor3 = q
print("Changed")
end)

This is just my guess so sorry if it doesn't work

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