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

Having issues controlling car lights with an ImageButton?

Asked by 3 years ago

Hi, for some reason I can't get lights to turn on using an ImageButton gui. Here is my code

local isOn = false veh = script

function on() isOn = true veh.Headlight.SpotLight.Enabled = true veh.Headlight.BillboardGui.Enabled = true veh.Headlightt.SpotLight.Enabled = true veh.Headlightt.BillboardGui.Enabled = true veh.Taillight.SpotLight.Enabled = true veh.Taillight.BillboardGui.Enabled = true veh.Taillightt.SpotLight.Enabled = true veh.Taillightt.BillboardGui.Enabled = true

end

function off() veh.Headlight.SpotLight.Enabled = false veh.Headlight.BillboardGui.Enabled = false veh.Headlightt.SpotLight.Enabled = false veh.Headlightt.BillboardGui.Enabled = false veh.Taillight.SpotLight.Enabled = false veh.Taillight.BillboardGui.Enabled = false veh.Taillightt.SpotLight.Enabled = false veh.Taillightt.BillboardGui.Enabled = false end

function onButtonClicked()

if isOn == true then off() else on() end

end

script.Parent.MouseButton1Click:connect(onButtonClicked)

Answer this question