So uh, i have a system where steering value is divided by a certain angle, it changes the ‘‘strControl’’ value, but somehow it doesn’t update its steer value getting divided doesn’t even work, anything wrong? if i delete the wait() it will get a script timeout, so please i need help.
-- Setup variables.
local spd = 0
local mxspd = script.Parent.Configuration["Max Speed"].Value
local accel = script.Parent.Configuration.Acceleration.Value
local decel = script.Parent.Configuration["Coast Deceleration"].Value
local brk = script.Parent.Configuration["Brake Power"].Value
local str = math.rad(script.Parent.Configuration.Steering.Value)
local strControl = script.Parent.Configuration.SteerControl.Value
-- Load config variables.
local speedcounter = script.Parent.Configuration.Speedometer.Value
-- Main loop.
while true do
wait(0.0000001)
-- Do steering.
if script.Parent.VehicleSeat.Steer == 1 then
script.Parent.Left_Steer.TopParamB = str / strControl
script.Parent.Right_Steer.TopParamB = str / strControl
elseif script.Parent.VehicleSeat.Steer == -1 then
script.Parent.Left_Steer.TopParamB = -str / strControl
script.Parent.Right_Steer.TopParamB = -str / strControl
else
-- script.Parent.Left_Steer.TopParamB = 0
-- script.Parent.Right_Steer.TopParamB = 0
end
-- Do throttle.
if script.Parent.VehicleSeat.Throttle == 1 then
if spd > 0 then
if spd < mxspd then
decel = decel/spd
spd = spd + accel
end
else
spd = spd + brk
end
elseif script.Parent.VehicleSeat.Throttle == -1 then
if spd < 0 then
if spd > mxspd/-2 then
spd = spd - accel
end
else
spd = spd - brk
end
else
spd = spd/decel
end
script.Parent.Front_Right.FrontParamB = -spd
script.Parent.Rear_Right.FrontParamB = -spd
script.Parent.Front_Left.BackParamB = spd
script.Parent.Rear_Left.BackParamB = spd
script.Parent.Screen.SurfaceGui.TextBox.Text = (math.floor(spd*100)/10).."/"..mxspd*10
script.Parent.VehicleSeat.Sound.PlaybackSpeed = 0.12+math.abs(spd*0.16)
script.Parent.Configuration.Speedometer.Value = (math.floor(spd*100)
)
print(strControl)
end