Animation not working

Hello Developers, I need some help with scripting this animation. I’m currently working on a new simulator game, and I’m using the script here in my game. But the script does not work, and I need some help.

THE SCRIPT

local player = game.Players.LocalPlayer

script.Parent.Activated:Connect(function()
	if player.Debounce.Value == false then
		game.ReplicatedStorage.RemoteEvents.Power:FireServer(script.Parent.Values)
		
		local action = script.Parent.Parent.Humanoid:LoadAnnimation(script.Animation)
	
		action:Play()
	end
end)

The errors:
In the output section, it says that character IsaacUniverse_YT does not have humanoid or something. And im quite confused.

The animation ID:
rbxassetid://522635514

Please comment below with answers :slight_smile:

Maybe try something like this??

script.Parent.Activated:Connect(function()
	if player.Debounce.Value == false then
		game.ReplicatedStorage.RemoteEvents.Power:FireServer(script.Parent.Values)
Local char = player.Character 
 Local hum = char:WaitForChild("Humanoid")
 Local animation = script.Animation
 If hum then
        Local action = hum:LoadAnimation(animation):Play()
	end)
end)
1 Like

Nope, thanks for trying but it gave me a lot of errors saying unfinished statement. Which I think means the script is unfinished.

script.Parent.Activated:Connect(function()
	if player.Debounce.Value ~= true then
		game.ReplicatedStorage.RemoteEvents.Power:FireServer(script.Parent.Values)
		local humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid") -- Assuming it's a localscript
		if humanoid then
			local action = script.Parent.Parent.Humanoid:LoadAnimation(script.Animation)
			action:Play()
		end
	end
end)
1 Like

Welp…glad to be help even though mine is not the solution :sweat_smile: :sweat_smile:

1 Like