I have a bus game where if you are in the driver seat a GUI pops up where you can see a button that says headlights. It's a togglable button to turn the headlights on and off. I used to have the code in a local script, which worked, but then I realized that only the person who clicked it could see it (client-sided). I then copied the code over to a script and it stopped working...
Here's the code VV
local button = script.Parent
local light = game.Workspace.Headlights.Headlight1.SpotLight
local headlight = game.Workspace.Headlights.Headlight1
local light2 = game.Workspace.Headlights.Headlight2.SpotLight
local headlight2 = game.Workspace.Headlights.Headlight2
local toggled = false
local function onButtonActivated()
if toggled == false then
headlight.Material = 288
light.Brightness = 1
headlight2.Material = 288
light2.Brightness = 1
toggled = true
else
headlight.Material = 256
light.Brightness = 0
headlight2.Material = 256
light2.Brightness = 0
toggled = false
end
end
button.Activated:Connect(onButtonActivated)
