Since the tween dictionary can’t just use built-in functions unless specified which property you’re working with, you may need to change the code to this:
local TweenService = game:GetService("TweenService")
local Humanoid : Humanoid = nil
local Animation : AnimationTrack = nil
local LastConnections = {}
local function OnRunning()
for i, Connection in ipairs(LastConnections) do
Connection:Disconnect()
table.remove(LastConnections, i)
end
local NumberValue = Instance.new("NumberValue")
NumberValue.Value = 1
local Tween = TweenService:Create(NumberValue, TweenInfo.new(2), {Value = 1.7})
Animation:AdjustSpeed(NumberValue.Value)
local Connection = NumberValue:GetPropertyChangedSignal("Value"):Connect(function()
Animation:AdjustSpeed(NumberValue.Value)
end)
Tween:Play()
local EndConnection = Tween.Completed:Once(function()
Connection:Disconnect()
NumberValue:Destroy()
end)
table.insert(LastConnections, Connection)
table.insert(LastConnections, EndConnection)
end
Humanoid.Running:Connect(OnRunning)