Player local scripts & animations doesnt work

hello roblox developers, today i have a worst bug and my program brain is small, so here’s the issue.

i copied the npc’s scripts that i scripted for the npc, yes, then pasted to StarterCharacterScripts that i thought it will work.
Video:

Issue: The Player animations doesn’t play either the local scripts too, maybe its delayed or something?

Reply to me back if you need the script to solve the issue.

Can you send the part of the script that’s throwing errors?

1 Like

Script:

local danceanim = script.Parent.Humanoid:LoadAnimation(script:FindFirstChild("DanceAnim"))
danceanim:Play()
while wait() do
	if game.Workspace.Sound.PlaybackLoudness > 1 then
		danceanim:AdjustSpeed(workspace.Sound.PlaybackLoudness * 0.006)
	end
	end

Bass:

local bassanim = script.Parent.Humanoid:LoadAnimation(script:FindFirstChild("BassAnim"))
local bass = script.Bass
while wait() do
	if game.Workspace.Sound.PlaybackLoudness > 1 then
		bass.Value = workspace.Sound.PlaybackLoudness * 0.0042
		if bass.Value >= 2 then
			bassanim:Play()
		elseif bass.Value <= 1 then
			bassanim:Stop()
		end
	end
end

1 Like
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:FindFirstChild('Humanoid')
local AnimTrack = Humanoid:LoadAnimation(script.DanceAnim)

local function anim()
	while wait(.1) do
		if Character then
			AnimTrack:Play()
			break
		end
	end
end
task.spawn(anim)

local function idk()
	while wait() do
		if game.Workspace.Sound.PlaybackLoudness > 1 then
			AnimTrack:AdjustSpeed(workspace.Sound.PlaybackLoudness * 0.006)
		end
	end
end
task.spawn(idk)


task.wait(2)
print('Stopping')
AnimTrack:Stop()

That should work for the Script if possible can you tell me what you’re trying to achieve with the Bass section?


still doesnt work by the way, also the bass is almost the same as the “script”, here is a issue of the bass.

1 Like

Just wanted to try something I’m not sure why it’s not working on your end in my workspace it seems to be fine, anyways try this and let me know what else it says:

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild('Humanoid')
local AnimTrack = Humanoid:LoadAnimation(script:FindFirstChild('DanceAnim'))

local function anim()
	while wait(.1) do
		if Character then
			AnimTrack:Play()
			break
		end
	end
end
task.spawn(anim)

local function idk()
	while wait() do
		if game.Workspace.Sound.PlaybackLoudness > 1 then
			AnimTrack:AdjustSpeed(workspace.Sound.PlaybackLoudness * 0.006)
		end
	end
end
task.spawn(idk)


task.wait(2)
print('Stopping')
AnimTrack:Stop()


Before it works, now it stops for some reason, i hope you know why, i checked the console, says the loadanimation requires an Animation object?
image

I’m not sure about the error at the moment, the reason it stops is because of a test I left in the script which is my mistake. here’s the edited one:

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild('Humanoid')
local AnimTrack = Humanoid:LoadAnimation(script:FindFirstChild('DanceAnim'))

local function anim()
	while wait(.1) do
		if Character then
			AnimTrack:Play()
			break
		end
	end
end
task.spawn(anim)

local function idk()
	while wait() do
		if game.Workspace.Sound.PlaybackLoudness > 1 then
			AnimTrack:AdjustSpeed(workspace.Sound.PlaybackLoudness * 0.006)
		end
	end
end
task.spawn(idk)
1 Like

It works, thank you, the bass one i will try to fix it myself.

1 Like

Alright if you have any other problems in the next 14 hours just respond to this message

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.