I've been trying to modify a script that would give a lighting effect when a button is pushed, and instead of using the ambient (as code in the script was before), I'm trying to use SpotLights. I'm attempting this method instead of the ambient because it would give a stronger effect, but the effect only works when the script does. Instead of changing the respective colours and brightnesses of the SpotLights, they stay their natural colour. Once activated, the following lines of the script are supposed to run:
game.Workspace.SourceFour1.PanMe.TiltMe.Light.SpotLight.Color = Color3.new(1,1,1) game.Workspace.SourceFour1.PanMe.TiltMe.Light.SpotLight.Brightness = 3 game.Workspace.SourceFour2.PanMe.TiltMe.Light.SpotLight.Color = Color3.new(1,0,0) game.Workspace.SourceFour2.PanMe.TiltMe.Light.SpotLight.Brightness = 3 wait(.1) game.Workspace.SourceFour1.PanMe.TiltMe.Light.SpotLight.Color = Color3.new(0,0,0) game.Workspace.SourceFour1.PanMe.TiltMe.Light.SpotLight.Brightness = 0 game.Workspace.SourceFour2.PanMe.TiltMe.Light.SpotLight.Color = Color3.new(0,0,0) game.Workspace.SourceFour2.PanMe.TiltMe.Light.SpotLight.Brightness = 0 wait(.1)
One the sequence noted above would be turned off, the script would return it to its natural colour and brightness, which is 1,1,1 and 3, respectively, though I need to make the sequence work before I can test that. I've tried taking the part named Light out of the model and leaving it in the Workspace in its lonesome, renaming it to prevent clashing with other parts called Light, but to no avail. I've also put a script directly into a SpotLight only to check and see if it could change its colours, which it did. Can someone help me?
[EDIT, 5/29] I have found out the reasoning behind its failure. The script was disabled.
You seem to forgot the basis of Color3.new! 'Any number in Color3.new must have a /255 right next to it for binary to read correctly' So in this case it would be...
game.Workspace.SourceFour1.PanMe.TiltMe.Light.SpotLight.Color = Color3.new(1/255,1/255,1/255) game.Workspace.SourceFour1.PanMe.TiltMe.Light.SpotLight.Brightness = 3 game.Workspace.SourceFour2.PanMe.TiltMe.Light.SpotLight.Color = Color3.new(1/255,0/255,0/255) game.Workspace.SourceFour2.PanMe.TiltMe.Light.SpotLight.Brightness = 3 wait(.1) game.Workspace.SourceFour1.PanMe.TiltMe.Light.SpotLight.Color = Color3.new(0/255,0/255,0/255) game.Workspace.SourceFour1.PanMe.TiltMe.Light.SpotLight.Brightness = 0 game.Workspace.SourceFour2.PanMe.TiltMe.Light.SpotLight.Color = Color3.new(0/255,0/255,0/255) game.Workspace.SourceFour2.PanMe.TiltMe.Light.SpotLight.Brightness = 0 wait(.1)
Plus for a repeat just do
while true do game.Workspace.SourceFour1.PanMe.TiltMe.Light.SpotLight.Color = Color3.new(1/255,1/255,1/255) game.Workspace.SourceFour1.PanMe.TiltMe.Light.SpotLight.Brightness = 3 game.Workspace.SourceFour2.PanMe.TiltMe.Light.SpotLight.Color = Color3.new(1/255,0/255,0/255) game.Workspace.SourceFour2.PanMe.TiltMe.Light.SpotLight.Brightness = 3 wait(.1) game.Workspace.SourceFour1.PanMe.TiltMe.Light.SpotLight.Color = Color3.new(0/255,0/255,0/255) game.Workspace.SourceFour1.PanMe.TiltMe.Light.SpotLight.Brightness = 0 game.Workspace.SourceFour2.PanMe.TiltMe.Light.SpotLight.Color = Color3.new(0/255,0/255,0/255) game.Workspace.SourceFour2.PanMe.TiltMe.Light.SpotLight.Brightness = 0 wait(.1) wait(.1) end
Thanks! ~marcoantoniosantos3