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

[FIXED]why doesn't my animation play when clicked?

this is my script

------------------< variables >----------------
local uis = game:GetService("UserInputService")
local saber = script.Parent
local p = game.Players.LocalPlayer
local l = p.leaderstats
local equipped = false
local textBox = game.StarterGui.Strenght.TextLabel
local anim = script.Parent:WaitForChild("SwingAnimation")
------------------< code >---------------------
saber.Equipped:Connect(function()
	equipped = true
end)
saber.Unequipped:Connect(function()
	equipped = false
end)
uis.InputBegan:Connect(function(input1)
	local mouseIn1 = input1.UserInputType
	if equipped == true and mouseIn1 == Enum.UserInputType.MouseButton1 then
		l.Strenght.Value = l.Strenght.Value + 5
		local loadedAnim = p.Character.Humanoid:LoadAnimation(anim)
		loadedAnim:Play()
	end
end)

it's a local script and it's parented to a tool. all the parts work, exept the animation part. what did i do wrong?

2 comments

0

It should work. Are there any errors?

0

ummm yeah it says that the animation variable is a nil value

1 answer

fixed it. for any people that struggle with the same issue, when you edit the animation go in the edit tab and set the priority to action

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