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
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
local plr = game.Players.LocalPlayer
local color = plr.PlayerGui:WaitForChild("Keys").ColourDisplay.ImageColor3
while true do
script.Parent.Color = Color3.fromRGB(color)
end
local plr = game.Players.LocalPlayer
local color = plr.PlayerGui:WaitForChild("Keys"):WaitForChild("ColourDisplay").ImageColor3
while true do
script.Parent.Color3 = Color3.fromRGB(color)
end
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.
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