I’m trying to make an ELS System for a vehicle for my game, When the event is fired the BoolValue would change it’s value, but the value doesn’t change at all. Could somebody help me out?
local Parent = script.Parent
local ELS_Event = Parent.ELS_Event
local ELS_Value = Parent.ELS_Enabled
local Lightbar = Parent.Lights
local Front1 = Lightbar.Front1
local Front2 = Lightbar.Front2
local Front3 = Lightbar.Front3
local Front4 = Lightbar.Front4
local Front5 = Lightbar.Front5
local Front6 = Lightbar.Front6
local Back1 = Lightbar.Back1
local Back2 = Lightbar.Back2
local Back3 = Lightbar.Back3
local Back4 = Lightbar.Back4
local Back5 = Lightbar.Back5
local Back6 = Lightbar.Back6
local Left = Lightbar.Left
local Right = Lightbar.Right
ELS_Event.OnServerEvent:Connect(function()
if ELS_Value.Value == false then
ELS_Value.Value = true
elseif ELS_Value.Value == true then
ELS_Value.Value = false
end
end)
local function ELS_Enabled()
Front1.BillboardLight.Amber.Visible = true
Front1.SurfaceLight.Amber.Visible = true
--
Front2.SurfaceLight.Amber.Visible = true
Front2.BillboardLight.Amber.Visible = true
--
Front3.SurfaceLight.Amber.Visible = true
Front3.BillboardLight.Amber.Visible = true
--
Right.SurfaceLight.Amber.Visible = true
Right.BillboardLight.Amber.Visible = true
--
Front4.BillboardLight.Amber.Visible = false
Front4.SurfaceLight.Amber.Visible = false
--
Front5.SurfaceLight.Amber.Visible = false
Front5.BillboardLight.Amber.Visible = false
--
Front6.SurfaceLight.Amber.Visible = false
Front6.BillboardLight.Amber.Visible = false
--
Left.SurfaceLight.Amber.Visible = false
Left.BillboardLight.Amber.Visible = false
wait(0.5)
Front1.BillboardLight.Amber.Visible = false
Front1.SurfaceLight.Amber.Visible = false
--
Front2.SurfaceLight.Amber.Visible = false
Front2.BillboardLight.Amber.Visible = false
--
Front3.SurfaceLight.Amber.Visible = false
Front3.BillboardLight.Amber.Visible = false
--
Right.SurfaceLight.Amber.Visible = false
Right.BillboardLight.Amber.Visible = false
--
Front4.BillboardLight.Amber.Visible = true
Front4.SurfaceLight.Amber.Visible = true
--
Front5.SurfaceLight.Amber.Visible = true
Front5.BillboardLight.Amber.Visible = true
--
Front6.SurfaceLight.Amber.Visible = true
Front6.BillboardLight.Amber.Visible = true
--
Left.SurfaceLight.Amber.Visible = true
Left.BillboardLight.Amber.Visible = true
end
local function ELS_Disabled()
Front1.BillboardLight.Amber.Visible = false
Front1.SurfaceLight.Amber.Visible = false
--
Front2.SurfaceLight.Amber.Visible = false
Front2.BillboardLight.Amber.Visible = false
--
Front3.SurfaceLight.Amber.Visible = false
Front3.BillboardLight.Amber.Visible = false
--
Right.SurfaceLight.Amber.Visible = false
Right.BillboardLight.Amber.Visible = false
--
Front4.BillboardLight.Amber.Visible = false
Front4.SurfaceLight.Amber.Visible = false
--
Front5.SurfaceLight.Amber.Visible = false
Front5.BillboardLight.Amber.Visible = false
--
Front6.SurfaceLight.Amber.Visible = false
Front6.BillboardLight.Amber.Visible = false
--
Left.SurfaceLight.Amber.Visible = false
Left.BillboardLight.Amber.Visible = false
end
ELS_Event.OnServerEvent:Connect(function()
ELS_Value.Value = not ELS_Value.Value
if ELS_Value.Value then
ELS_Enabled()
else
ELS_Disabled()
end
end)