I need help with my Punching Script

So basically, this error keeps popping up, and since like I’m kinda new to scripting I don’t know to fix it.

Here’s the code:

local plr = game.Players.LocalPlayer
local char = plr.Character
local hum = char.Humanoid
local UIS = game:GetService("UserInputService")
local PunchRID = "http://www.roblox.com/asset/?id=5082260922"

UIS.InputBegan:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.E then
		local PunchRightAnim = Instance.new("Animation")
		PunchRightAnim.AnimationId = PunchRID
		local LoadRAnim = hum:LoadAnimation(PunchRightAnim)
		LoadRAnim:Play()
	end
end)

Thank you so much for reading.

Is it your animation? Roblox does not allow users to use other users animation.

2 Likes

Maybe, soccervr is right. Animation should be your own. Or it should belong to your group. Make your own new animation.

Where are you testing from? You own the animation so it should load in any places you’re developing on your profile. If this code is in a group game, you will not be able to use it. I otherwise cannot discern any actual problem here other than ownership and testing environment.

If its a group animation, you have to import the animation in “group animations”
^ just noting :d

Try:

local PunchRID = "rbxassetid://5082260922"

The Roblox Dev Hub says:

Copy the Id, not the entire link.
See this for more details:

The asset id link is still proper in the OP. rbxassetid://x is the ContentId shorthand for https://www.roblox.com/asset/?id=x. They aren’t using the improper link.

See this article for more information on asset links:
https://developer.roblox.com/en-us/articles/Content