I have this script that changes an animations speed with sound loudness, and it does not work. Any help? Here is the script
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
Idle = Humanoid:LoadAnimation(script.Dance)
Idle.Looped = true
Idle:Play()
while true do
Idle.Speed = math.clamp(game.Workspace.KohlAudioVisualizer.Sound.PlaybackLoudness/700, 0.2, 0.5)
end
You do realize that the npc has a script that uses AdjustSpeed and the boolvalue is just to make it easier to set right?
The script Shea Used:
--Variables--
local set = script.Settings
local sp = set.Speed
local enabled = set.Enabled
local hum = script.Parent:WaitForChild("Humanoid")
if hum then
print("Success")
else
print("No Humanoid")
end
local humanim = hum:LoadAnimation(script:FindFirstChildOfClass("Animation"))
--Playing Animation--
if enabled.Value == true then
humanim:Play()
humanim.Looped = true
humanim:AdjustSpeed(sp.Value) -- This is what gets the boolvalue value and sets the speed with.
end
What does that mean? You cant just insert a Intvalue into a character and expect it to slow down and go faster based on music.
The person wants the speed to be adjusted by the music and PlaybackLoudness. You need AdjustSpeed in order to do this. The tutorial you see just makes it easier by having the script already made which looks for the values and uses them as settings to change it to fit your need. What he wants to do is make it speed up and slow down based on the loudness of the music thats being played.
Greetings from 2021. This is the top search result when you look for changing character animation speed.
Looks like there was some confusion about what people meant up there. Maybe the current answer wasn’t valid back then, but
So:
-- Original poster had:
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
-- so get the config value to base the adjustment on:
local scaleDampening = Character:WaitForChild("Animate"):WaitForChild("ScaleDampeningPercent")
local defaultDampening = scaleDampening.Value
-- then where you want to change the speed:
local speedFactor = 0.5 -- half animation speed
scaleDampening.Value = defaultDampening / speedFactor
I’m pretty sure if I was trying to do what OP was trying to do, I would maybe temporarily change the character’s idle animation set to the custom dance animation.
More likely, just add a new dance animation to the animation sets as a custom emote and set the emote.