Animation Script

I’m a beginner scripter and I’m trying to make an animation with a ProximityPrompt, I’m not sure why it isn’t working or how to fix it. This is the script:

local Part = proximityPrompt.Parent
local UserInputService = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")

proximityPrompt.Triggered:Connect(function(player)
	local Animation = Instance.new("Animation")
	
	Animation.AnimationId = "rbxassetid://8829102602"
	local Track = Humanoid:LoadAnimation(Animation)
	Track:Play()
	
end)
2 Likes

where is ur script and proximity prompt in explorer

Is the code inside a local script or server script, and where is it located?

image
It is inside a normal part and is a localscript.

1 Like

Why not just do:

proximityPrompt.Triggered:Connect(function(player)
	local Animation = Instance.new("Animation")
	local PlayerHumanoid = workspace:FindFirstChild(player.Name).Humanoid
	Animation.AnimationId = "rbxassetid://8829102602"

	if PlayerHumanoid and Animation then --JUST TO MAKE SURE
		local Track = PlayerHumanoid:LoadAnimation(Animation)
		Track:Play()
	else
		warn("HUMANOID AND ANIMATION ARE NIL!")
	end
end)
1 Like

try this one:

local proximityPrompt= script.Parent
local UserInputService = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")

proximityPrompt.Triggered:Connect(function(player)
	local Animation = Instance.new("Animation")
	
	Animation.AnimationId = "rbxassetid://8829102602"
	local Track = Humanoid:LoadAnimation(Animation)
	Track:Play()
	
end)
1 Like

It still isn’t working, and no error shows up in the Output.

This one also isn’t working, I’m not sure why.

First change ur local script to normal script
second put this inside the normal script:

local players = game:GetService("Players").LocalPlayer

local part = script.Parent

part.Triggered:Connect(function(Player)

print("triggerd")

local c = Player.Character

local h = c:WaitForChild("Humanoid")

local ANim = Instance.new("Animation",workspace)

ANim.AnimationId = "rbxassetid://8829102602"

local Track = h:LoadAnimation(ANim)

Track:Play()

end)
1 Like

the print part is to check is the script working or not

It prints triggered and it’s in a normal script but the animation still does not play

if the script plays the animation how does it look like

It doesn’t play the animation still.

Try setting the priority of the animation to “Action” or “Movement”.

I’m pretty sure it is an action.

who export the animation cause sometime other players export the animation the animation can’t play for weird reason

I was the one that exported the animation.

the script is not the problem.The problem is the animation and idk why the animation didn’t play

I’ve tried exporting it three times, listed under movement and action. I’ve also tried using other peoples animations and it still isnt working

i tried my animation it works for me