How do i make it change the color?

hey guys i cant seem to figure out how to go from color3 to just color…
i want to get the color from the gui but it keeps getting errors (its prob really simple but i can’t figure it out…) here is the script i made but didn’t work.

local plr = game.Players.LocalPlayer
local color = plr.PlayerGui:WaitForChild("Keys").ColourDisplay.ImageColor3
while true do
	script.Parent.Color = Color3.new(color)
end

any help would be nice!?

try:

local plr = game.Players.LocalPlayer
local color = plr.PlayerGui:WaitForChild("Keys"):WaitForChild("ColourDisplay").ImageColor3
while true do
	script.Parent.Color = Color3.fromRGB(color)
end

if this is not working try this:

local plr = game.Players.LocalPlayer
local color = plr.PlayerGui:WaitForChild("Keys"):WaitForChild("ColourDisplay").ImageColor3
while true do
	script.Parent.Color = Color3.new(color)
end

and make sure the “plr” is really the player because if you using playergui then maybe you inside a server script

1 Like

i have tried this before… the sad thing is that it doesnt work :confused: so thanks for trying

you using server script?

o no wait let me try real quick…

its a local script vvvvvvvvvvvvvvvvvvv

local plr = game.Players.LocalPlayer
local color = plr.PlayerGui:WaitForChild("Keys").ColourDisplay.ImageColor3
while true do
	script.Parent.Color = Color3.fromRGB(color)
end

Try doing this

no effect :confused: still the same issue and i didnt want to play it on the server for now too.

same error evry time

what is
script.Parent?

can you show me the properties tab of ColourDisplay

a ray with a “Color” innit
image

try using color3 instead of colorsequence

local plr = game.Players.LocalPlayer
local color = plr.PlayerGui:WaitForChild("Keys"):WaitForChild("ColourDisplay").ImageColor3
while true do
	script.Parent.Color3 = Color3.fromRGB(color)
end

Hello!

Beam always requires ColorSequence.new() as a Color property. If you want a solid colored beam, it’s enough to give it one Color3 argument, that is ImageColor3 in your case.

I also suggest you only update the color on change and not actively in a loop. By the way, your loop would raise a runtime error because there is no task.wait().

local player = game:GetService("Players").LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")

local gui = playerGui:WaitForChild("Keys")
local colourDiplay = gui:WaitForChild("ColourDisplay")

local beam = workspace.Beam -- Suppose that's your beam.

colourDiplay:GetPropertyChangedSignal("ImageColor3"):Connect(function()
	print(colourDiplay.ImageColor3, typeof(colourDiplay.ImageColor3)) -- type test
	beam.Color = ColorSequence.new(colourDiplay.ImageColor3)
end)

Local scripts generally belong in StarterPlayerScripts and StarterCharacterScripts, perhaps also in StarterGui and StarterPack, depending on one’s script architecture. So I’d find a way to have this script access your beam from there and not have it inside the beam itself.

Instead of listening for change, you could also change the beam color in the script that changes the ImageColor3 of DisplayColours.

Beware, if you want the color change to be visible to everyone else in the game, you’ll have to ask the server to change it and send the color via remote events.

1 Like
	script.Parent.Color = color
1 Like
local plr = game.Players.LocalPlayer
local color = plr.PlayerGui:WaitForChild("Keys").ColourDisplay.ImageColor3
while wait() do -- This is not really the best method with true, use wait() instead
	script.Parent.Color = color
end
2 Likes

sure here:
image
its located in a tool cuz its a lightsaber and i want it to change color when you use the colorwheel…
do you have an example of what i could do next?

already tried this, sadly it didnt work :confused:

already tried this but thanks for trying