I'm new to scripting and I'm trying to make it so when you click or "pickup" the grass, an animation plays of you bending down and actually picking it up, but when I click it, the whole script works fine except that it won't play the animation.
Object = script.Parent
Max= 10
Clickey = script.Parent.ClickDetector
Name = "Grass"
function collect(plr)
local Grass = plr.leaderstats:FindFirstChild(Name)
local humanoid = plr.Character:WaitForChild("Humanoid")
local PickupAnim = Instance.new("Animation", humanoid)
PickupAnim.AnimationId = 'rbxassetid://1595224701'
local PickupAnimLoaded = humanoid:LoadAnimation(PickupAnim)
if Grass then
if Grass.Value >= Max then
print("You have too much")
return
else
Grass.Value = Grass.Value + 1
PickupAnimLoaded:Play()
return
end
end
end
Clickey.MouseClick:connect(collect)

1 comment
Still not working. :(