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

Change Color Script issue. Why is it not working? I would really like help.

Asked by
moo1210 587 Moderation Voter
6 years ago

Here is the script

game.Workspace.Light.SpotLight.Color3.new(255, 0, 0)

Yes it runs it. Here is the full script. I only need help with this bit tho.

Code = "412"
button = script.Parent.Parent.Enter
function Enter()
if (script.Parent.Text == Code) then
print("Accepted")
script.Parent.Text = "Lockdown Actived!"
script.Parent.Parent.Sound2:play()
wait(0.5)
script.Parent.Text = "Have a nice day"

game.Workspace.LockdownWarning:Play()
wait(19)
game.Workspace.LockdownMusic:Play()
game.Workspace.Light.SpotLight.Color3.new(255, 0, 0)


return end
script.Parent.TextColor3 = Color3.new(1,0,0)
wait(0.1)
script.Parent.TextColor3 = Color3.new(1,1,1)
wait(0.1)
script.Parent.TextColor3 = Color3.new(1,0,0)
wait(0.1)
script.Parent.TextColor3 = Color3.new(1,1,1)
wait(0.1)
script.Parent.TextColor3 = Color3.new(1,0,0)
wait(0.1)
script.Parent.TextColor3 = Color3.new(1,1,1)
wait(0.1)
script.Parent.Text = "Acces Denied"
script.Parent.Parent.Sound3:play()
wait(0.1)
script.Parent.Parent.Sound3:play()
script.Parent.TextColor3 = Color3.new(1,0,0)
wait(0.5)
script.Parent.TextColor3 = Color3.new(1,1,1)
script.Parent.Text = ""
print("Denied")
end

button.MouseButton1Click:connect(Enter)

3 answers

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

First of all starting with this line, game.Workspace.Light.SpotLight.Color3.new(255, 0, 0), that's not how you set a property of an object. Second of all, the Color3 constructor takes three arguments from 0 to 1. If you want to construct a Color3 using RGB values, use Color3.fromRGB(R,G,B). With these corrections, the line should look like so.

game.Workspace.Light.SpotLight.Color = Color3.fromRGB(255, 0, 0)
Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

You did this:

game.Workspace.Light.SpotLight.Color3.new(255,0,0) -- That won't work

but color3 stores as 0-1 value, try this:

game.Workspace.Light.SpotLight.Color3.new(1, 0, 0)

or this...

game.Workspace.Light.SpotLight.Color3.fromRGB(255,0,0)
0
that still won't work... creeperhunter76 554 — 6y
0
@creeperhunter76, I tried and it works, can you explain why it didn't work? Blockzez 15 — 6y
Log in to vote
0
Answered by
H4X0MSYT 536 Moderation Voter
6 years ago

Ah. It is working i think. If the other solutions don't work, the color has changed but the light isnt visible.

Answer this question