This is the code. A localscript inside a tool. what is the error?
local anim = Instance.new(“Animation”) anim.AnimationId = “rbxassetid://1188415703” anim.Parent = script.Parent anim.Name = “CardHold” local key = script.Parent local hum = game.Players.LocalPlayer.Character.Humanoid local animTrack = hum:LoadAnimation(anim) key.Equipped:Connect(function() animTrack:Play() end) key.Unequipped:Connect(function() animTrack:Stop() end)
if you look closely at your quotations,
--[[ they look like this. “CardHold” look at where the ends are pointing at, it should look like this instead. "CardHold" tldr: use this: "" and not this: “”--]]
surely roblox should give you an error when you did that, cause it's an unknown symbol.
if your keyboard only has those type of quotation marks, you can just copy and paste these here.
--[[ "rbxassetid://1188415703" ("Animation") "CardHold" --]]
The problem is not your quotations. It is a problem i once ran into aswell.
The animation track thinks the character is nil. So instead of your code, try this:
local anim = Instance.new(“Animation”) anim.AnimationId = “rbxassetid://1188415703” anim.Parent = script.Parent anim.Name = “CardHold” local key = script.Parent local hum = game.Players.LocalPlayer.Character.Humanoid local animTrack = hum:LoadAnimation(anim) while char.Parent == nil do char.AncestryChanged:wait() end key.Equipped:Connect(function() animTrack:Play() end) key.Unequipped:Connect(function() animTrack:Stop() end)
Do you notice the new part in the code? This is there to keep the tool from animating until the character is not nil. Why they think its nil: i dont know why. Do I care: no.
Glad to help you!
ReadyHappiness