Hey all, so my script isn’t working, and is giving me an error that I cannot understand very well.
I’m a beginner script, so please explain it to me in the most braindead way that you can. That would help me out a lot, and this bug has been annoying me for quite some time now, and it would be nice to finally squash it. Every attempt I do on this simply leads to me getting more annoyed at the challenge.
local clipProvider = game:GetService("AnimationClipProvider")
local tool = script.Parent
local explosion = game.ReplicatedStorage:FindFirstChild("RedExplosion")
local player = game.Players.LocalPlayer
local character = game.Players.LocalPlayer.Character
tool.Activated:Connect(function(hit)
local animation = script:WaitForChild("Animation")
local animator = Instance.new("Animator")
local track = animator:LoadAnimation(animation)
track:Play()
end)
local clipProvider = game:GetService(“AnimationClipProvider”)
local tool = script.Parent
local explosion = game.ReplicatedStorage:FindFirstChild(“RedExplosion”)
local player = game.Players.LocalPlayer
tool.Activated:Connect(function(hit)
explosion:FireServer()
local character = player.Character
local humanoid = character:WaitForChild(“Humanoid”)
local animation = humanoid:WaitForChild(“Animation”)
local animator = Instance.new(“Animator”)
local track = animator:LoadAnimation(animation)
It seems like you’re trying to get the Animation from the Humanoid, when I meant you should get the Animator. Here’s the tool.Activated function updated:
tool.Activated:Connect(function(hit)
explosion:FireServer()
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
local animation = script:WaitForChild("Animation")
local track = animator:LoadAnimation(animation)
track:Play()
end)