local TweenService = game:GetService("TweenService")
local M1Animation = -- reference to your animation track
local animationSpeed = Instance.new("NumberValue") -- Create a NumberValue to store the animation speed
animationSpeed.Value = 0.4 -- Starting speed
-- Tween Information
local tweenInfo = TweenInfo.new(
1, -- Duration (time it takes to complete the tween)
Enum.EasingStyle.Linear, -- EasingStyle (smooth linear change)
Enum.EasingDirection.Out, -- EasingDirection (can be In, Out, or InOut)
0, -- RepeatCount (no repeat)
false, -- Reverses (no reverse)
0 -- DelayTime (no delay)
)
-- Create the tween
local tween = TweenService:Create(animationSpeed, tweenInfo, {Value = 0.7}) -- Target speed
-- Adjust the animation speed whenever the NumberValue changes
animationSpeed.Changed:Connect(function(newSpeed)
M1Animation:AdjustSpeed(newSpeed)
end)
tween:Play()
create a numbervalue that has a parent in somewhere that you will probably not access (like replicatedstorage), tween the value, and every server tick, set the tween speed to the numbervalue’s value.