local holding = script.Parent.Holding
local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/asset/?id=16571466944"
repeat wait() until game:GetService("Players").LocalPlayer.Character.Humanoid
if script.Parent.Equipped then
game:GetService("Players").LocalPlayer.Character.Humanoid:LoadAnimation(animation):Play()
end
if script.Parent.Unequipped then
animation:Stop()
end
This is my first time using proper animations.
I get these errors: StarterPack.BatteringRam.Script:4: attempt to index nil with ‘Humanoid’ Stop is not a valid member of Animation “Animation”
I’m going to be honest, I have no clue why this happens.
I may seem annoying for not looking into documentation(I did, wasn’t so helpful)
lol i was getting same errors when i was really really beginner on scripting animations so i feel you. you should do it like
local animtrack = game:GetService("Players").LocalPlayer.Character.Humanoid:LoadAnimation(animation)
if script.Parent.Equipped then
animtrack:Play()
end
if script.Parent.Unequipped then
animtrack:Stop()
end
thanks for knowing the pain.
but, i either way had to completely change the script, because i needed to add a new functions for something! but, i’m in middle of fixing it right now, so ill use this script to help. thanks btw!
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local Humanoid = character:WaitForChild("Humanoid")
local holding = script.Parent.Holding
local animation = Instance.new("Animation")
animation.AnimationId = ""-- your animation id
local Anim = Humanoid:LoadAnimation(animation)
if script.Parent.Equipped then
Anim:Play()
end
if script.Parent.Unequipped then
Anim:Stop()
end
@How4rdy
none of these responses ended up helping(to be honest), but the issue was very simple, and just something i somehow did not notice!
it had to be: script.Parent.Equipped:Connect(function()
instead of: if script.Parent.Equipped then