Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Same game,Another error,can you help me?(In-NeEd MoDe)

Here the ErRoR = 20:30:03.523 - Players.m6xw.Backpack.Weight.Animation:3: attempt to index nil with 'AnimationId'

AnD ThE sCrIpT :

local tool = script.Parent
local anim Instance.new("Animation")
anim.AnimationId = "rbxassetid://4928303202"
local track
tool.Activated:Connect(function()
	track = script.Parent.Parent.Humanoid:LoadAnimation(anim)
	track.Priority = Enum.AnimationPriority.Action
	track.Looped = false
	track:Play()
end)
tool.Unequipped:Connect(function()
	if track then
		track:Stop()
	end
end)

1 comment

0

;-;

1 answer

Hello.


Solution:

You forgot the "=" while making a variable.


Fixed Script:

local tool = script.Parent

local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://4928303202"

local track
tool.Activated:Connect(function()
    track = script.Parent.Parent.Humanoid:LoadAnimation(anim)
    track.Priority = Enum.AnimationPriority.Action
    track.Looped = false
    track:Play()
end)
tool.Unequipped:Connect(function()
    if track then
        track:Stop()
    end
end)

1 comment

0

Thank you

This discussion is preserved as it was. New answers, comments, and votes are closed.