Hey Developers!
I was wondering if anyone could help me, I’m making a system where you can press a coloured button on a GUI and it changes light parts to that colour. I have a script, but it’s changing the colour to black not the colour of the button. I would usually just define the colour but I have about 30 different buttons with different colours so I wanted to try doing it differently instead of trying to define every colour.
GUI Script
newcolor = script.Parent.BackgroundColor3
script.Parent.MouseButton1Click:Connect(function(plr)
game.ReplicatedStorage.LightsEvent:FireServer(newcolor)
end)
Server Script
local Event = game.ReplicatedStorage.LightsEvent
Event.OnServerEvent:Connect(function(player,newcolor)
for i,v in pairs(workspace.StageLights:GetDescendants()) do
if v:isA("BasePart") then
v.PointLight.Color = Color3.new(newcolor)
end
end
end)
Any help would be appreciated. 