Dance Animation Speed Gui

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear! I want to make the dance GUI look really good and learn more about scripting.

  2. What is the issue? Include screenshots / videos if possible! I want to make a dance speed button gui where you speed up the dance or slow it down like thisimage

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub? I try a lot of stuff but none of them work and I looked on developer hub but there is nothing like what Im trying to looking for.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that itā€™s easier for people to help you!

-- This is an example Lua code block

Please do not ask people to write entire scripts or design entire systems for you. If you canā€™t answer the three questions above, you should probably pick a different category.

1 Like

You can use Track:AdjustSpeed to change the speed.

1 Like

So I will put this local script in a text button?

local normalSpeedTime = animationTrack.Length / animationTrack.Speed
animationTrack:AdjustSpeed(3)
local fastSpeedTime = animationTrack.Length / animationTrack.Speed
print(ā€œAt normal speed the animation will play forā€, normalSpeedTime, ā€œsecondsā€)
print(ā€œAt 3x speed the animation will play forā€, fastSpeedTime, ā€œsecondsā€)

local animationTrack = humanoid:LoadAnimation(animation)

local normalSpeedTime = animationTrack.Length / animationTrack.Speed
animationTrack:AdjustSpeed(3)
local fastSpeedTime = animationTrack.Length / animationTrack.Speed

print(ā€œAt normal speed the animation will play forā€, normalSpeedTime, ā€œsecondsā€)

print(ā€œAt 3x speed the animation will play forā€, fastSpeedTime, ā€œsecondsā€)

Sorry for the late response but youā€™d connect a event to detect if the button has been clicked, get all the playing tracks, loop through the tracks and call the function (im on mobile so there might be mistakes):

local Players = game:GetService('Players')

local player = Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()

local humanoid = char:WaitForChild('Humanoid')
local animator = humanoid:WaitForChild('Animator')

script.Parent.Activated:Connect(function()
    local tracks = animator:GetPlayingAnimationTracks()
   
    for _, track in pairs(tracks) do
        track:AdjustSpeed(2)
    end
end)
1 Like

Thank you but like the part ā€œcurrentTrack:AdjustSpeed(2)ā€ currentTrack has a blue line thats is ok right?

Small typo, replace ā€œcurrentTrackā€ with ā€œtrackā€.

thank you so much for helping.

1 Like

i change a bit of the script but like when im walking it change the speed too i want it only change the dance speed.

local Players = game:GetService(ā€˜Playersā€™)

local player = Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local dancing = false

local humanoid = char:WaitForChild(ā€˜Humanoidā€™)
local animator = humanoid:WaitForChild(ā€˜Animatorā€™)

script.Parent.Activated:Connect(function()
local tracks = animator:GetPlayingAnimationTracks()
while dancing do
wait()
for _, track in pairs(tracks) do
track:AdjustSpeed(5)
end
end
end)