Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

PointLight change on a GUI. Help on this?!!

Asked by 9 years ago

Hi,

I am having a few problems with this script today is that it wont change the colour of the PointLight when pressed on the GUI. I am running this for my bowling alley which enables and disables in glow mode. But can you help me out?

I have tested this in the Test Server (as shown in the output as Player), but it doesn't work.

Error from Output:

17:40:02.296 - Players.Player.PlayerGui.WorkingOnGui.CeilingLightControl.G:3: bad argument #3 to 'Color' (Color3 expected, got boolean) 17:40:02.298 - Script 'Players.Player.PlayerGui.WorkingOnGui.CeilingLightControl.G', Line 3 17:40:02.301 - Stack End

Script:

function change()
for i = 1, 12 do
workspace:FindFirstChild("LightA"..i).PointLight.Color3.new = not workspace:FindFirstChild("LightA"..i).PointLight.Color3.new
workspace:FindFirstChild("Light"..i).PointLight.Color3.new = not workspace:FindFirstChild("Light"..i).PointLight.Color3.new
if workspace:FindFirstChild("LightA"..i).PointLight.Color3.new(255,255,255) then
if workspace:FindFirstChild("Light"..i).PointLight.Color3.new(255,255,255) then

--Configuring ceiling and lane lights to be switched on
script.Parent.BackgroundColor3 = Color3.new(0,85,0)
workspace:FindFirstChild("LightA"..i).PointLight.Color3.new(255,255,255)
workspace:FindFirstChild("Light"..i).PointLight.Color3.new(255,255,255)
script.Parent.Text = "Glow Mode: Turn On"
else
--Configuring ceiling and lane lights to be switched off
script.Parent.BackgroundColor3 = Color3.new(170,0,0)
workspace:FindFirstChild("LightA"..i).PointLight.Color3.new(0,0,255)
workspace:FindFirstChild("Light"..i).PointLight.Color3.new(0,0,255)
script.Parent.Text = "Glow Mode: Turn Off"
end
end
end
end

script.Parent.MouseButton1Down:connect(change)

Thanks! :)

2 answers

Log in to vote
1
Answered by 9 years ago

The error is basically telling you "Color3" is not a property. You're changing the color all wrong. Also, I have no idea what you're doing setting something equal to not, this does nothing. Even if you mean to use == it wont work because this will do nothing.

Here is an example on how to change the color of a point light so you may change what you did in your code.

script.Parent.Color = Color3.new(0,111,0)

That will make a point light a greenish Color. Only if the script is inside of the light! As you see you're doing something different like you would for changing a parts color (BrickColor = BrickColor.new() but instead it's Color = Color3.new(). Your code is messy and this is all I can help you with in that condition.

0
Please look below, I have tried - but doesn't work. Could you try and code it? BenHall4433 0 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

I have changed the script in to this, but why does is still not work after it has been clicked. It just does nothing!

function lighting()
    local l = workspace:FindFirstChild("LightA1", "LightA2", "LightA3", "LightA4", "Light1", "Light2", "Light3", "Light4", "Light5", "Light6", "Light7", "Light8")

    if l.PointLight.Color == Color3.new(255,255,255) then
    script.Parent.BackgroundColor3 = Color3.new(0,85,0)
    script.Parent.Text = "Glow Mode: Turn On"
    l.PointLight.Color = Color3.new(255,255,255)
    else
    script.Parent.BackgroundColor3 = Color3.new(170,0,0)
    script.Parent.Text = "Glow Mode: Turn Off"
    l.PointLight.Color = Color3.new(0,0,255)

end
end

script.Parent.MouseButton1Down:connect(lighting)

Answer this question