So, I have an A-Chassis and a car, the chassis has a GUI with the ability to turn off/on specific lights.
This specific light I’m having problems with is supposed to rotate, which it half does, but half doesn’t.
It’s supposed to rotate on both Client-side and Server-side, but for some reason it only rotates on Server-Side, not Client-Side.
The script that enabled the lights (it’s a ServerScript).
task.wait(0.05)
local car = script.Parent.Parent.Parent.Car.Value
local lights = car.Misc.Model.Body.Lights
local TS = game:GetService("TweenService")
local TI = TweenInfo.new(0.1)
on = false
--
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Parent.Click:Play()
if on == false then
on = true
TS:Create(lights.WarningLight.Light1,TI,{Brightness = 0.3}):Play()
TS:Create(lights.WarningLight.Light2,TI,{Brightness = 0.3}):Play()
lights.WarningLight.Beacon.Enabled = true
else
on = false
TS:Create(lights.WarningLight.Light1,TI,{Brightness = 0}):Play()
TS:Create(lights.WarningLight.Light2,TI,{Brightness = 0}):Play()
lights.WarningLight.Beacon.Enabled = false
end
end)
Why tween it at all?
I’ve put rotating beacons on my vehicles just using a HingeConstraint. Set the AngularVelocity to 0 to stop it, or set it to 1 (or whatever number works for the speed you want) to start it.
I think that you could fire one of two remote events when it gets turned on and another one when it gets turned off in order to change a bool that can be used to rotate the lights when it is on, and then stop rotating them when it is off.
local onRemote = game:GetService("ReplicatedStorage").LightsRotate
local offRemote = game:GetService("ReplicatedStorage").LightsStopRotation
spinning = false
onRemote.OnClientEvent:Connect(function()
spinning = true
end)
offRemote.OnClientEvent:Connect(function()
spinning = false
end)
while spinning == true do
--Do whatever makes the lights spin with the server script here
end
I think that you could probably use only one remote event but I just used two.