Ok so ive got this pushing mechanic, and it changes the speed on the wheels by 50 each time and i have the value tween down to 0 slowly to make it feel smoother / like theres momentum but when the board gets stopped by setting the value to 0, on the second push it returns to the old value + the other push
amountval = Instance.new("NumberValue",LocalPlayer)
function go(amount)
if amountval.Value > 350 then
amountval.Value = 350
else
amountval.Value = amountval.Value + amount
end
print(amount)
print(amountval.Value)
end
game:GetService("RunService").Heartbeat:Connect(function()
if canChange == true then
if amountval.Value > 350 then
amountval.Value = 350
end
local tInfo = TweenInfo.new(10,Enum.EasingStyle.Linear)
local tween = game:GetService("TweenService"):Create(amountval,tInfo,{Value = 0})
tween:Play()
end
FRGO.AngularVelocity = -amountval.Value
FLGO.AngularVelocity = amountval.Value
RRGO.AngularVelocity = -amountval.Value
RLGO.AngularVelocity = amountval.Value
end)
i seriously have no clue i would fix this, thanks for any help.
go function adds speed to the wheels in incriments, so i could do go(50) and it would make the wheels spin at ‘50’ but if i called it again it would spin at ‘100’ and i dont think the problem is it firing too many times as its in a debounce
well this complicates things, so i have two different places that call the function. one being on the first push, and the rest being on a function where if the animation loops it also calls the function, for some reason though it seems to count how many times it has looped in the past and adds one? heres my code and a video demonstrating;
local function KeepPushing()
if not pushdb then
goofyanims['PushLoop'].DidLoop:Connect(function()
wait(.1)
go(50)
print("go!")
end)
regularanims['PushLoop'].DidLoop:Connect(function()
wait(.1)
go(50)
print("go!")
end)
pushdb = true
wait(.1)
pushdb = false
end
end