Hello! I’m making an item that you can throw and it will deal damage to npc’s. If the player picks the item up while its in workspace, the script works fine, but if I put the item in StarterPack the script stops working and I get this error:
local plr = game.Players.LocalPlayer
local cooldown = false
local humanoid = plr.Character:WaitForChild("Humanoid") -- Where the error occurs
local animation = humanoid:LoadAnimation(script:WaitForChild("ThrowAnimation"))
script.Parent.Activated:Connect(function()
if cooldown == false then
cooldown = true
animation:Play()
script.ThrowEvent:FireServer( )
wait(1) --time for cooldown
cooldown = false
end
end)