The vehicle I’ve been building for the past few days is just a glorified and vastly improved version of Building a basic car. I (sort of) rewrote some parts of the original script from that tutorial and after hours of learning about constraints, The handling of the vehicle is way better than it was before (especially the steering).
I am clearly not done with it yet, I didnt add sound effects or animated the steering wheel/pedals yet (I dont know how to animate normal parts) or even add a proper body for the chassis.
Driving:
However I cant seem to remove this error:
I had this error before and knowing that it could cause issues in the long term and had no success fixing it.
So this is my project that taught me into constraints in a basic level and probably some animating. If you want to suggest any improvements or any thoughts about it then let me know. Thanks for reading.
On that error, are you adding new animation tracks every time you move the controls? What does the animation script look like? Can you post some of that?
Because this is not complete, There are lots of code scraps and crap that I left out or still use. Sorry if it is tricky to abstract any useful info but yes, I was adding new tracks unfortunately.
AnimateOnCmd---------------------------------------------------------------
]]
--local Humanoid = plr.Character:FindFirstChild("Humanoid")
--local animator = Humanoid:WaitForChild("Animator")
--local SteerRight = animator:LoadAnimation(AnimationSteerRight)
--local SteerLeft = animator:LoadAnimation(AnimationSteerLeft)
--local RightFootGas = animator:LoadAnimation(Animationgas)
--local LeftFootBrake = animator:LoadAnimation(AnimationBrake)
script.Parent.Changed:Connect(function(drst)
-- if drst == "Steer" or drst == "Throttle" then
if seat.Steer == 1 then
local Humanoid = plr.Character:FindFirstChild("Humanoid")
animator = Humanoid.Animator
PLayItNow = animator:LoadAnimation(AnimationSteerRight)
PLayItNow:Play()
elseif seat.Steer == -1 then
local Humanoid = plr.Character:FindFirstChild("Humanoid")
animator = Humanoid.Animator
PLayItNow = animator:LoadAnimation(AnimationSteerLeft)
PLayItNow:Play()
elseif seat.Steer == 0 then
if PLayItNow == nil then return false end
PLayItNow:Stop()
end
if seat.Throttle == 1 then
exausteffect.Fire.Enabled = true
WheelSmokeL.Smoke.Enabled = true
WheelSmokeR.Smoke.Enabled = true
local Humanoid = plr.Character:FindFirstChild("Humanoid")
animator = Humanoid.Animator
LegAnimation = animator:LoadAnimation(Animationgas)
LegAnimation:Play()
elseif seat.Throttle == -1 then
smokeffects()
local Humanoid = plr.Character:FindFirstChild("Humanoid")
animator = Humanoid.Animator
LegAnimation = animator:LoadAnimation(AnimationBrake)
LegAnimation:Play()
elseif seat.Throttle == 0 then
smokeffects()
if LegAnimation == nil then return end
LegAnimation:Stop()
end
-- end
end)