Hello,
I got an issue but i have no idea why it is happening.
The sword tool i made is only firing on Tool.Activated when it is collected from the floor but not from the StarterPack.
I dont get any errors or else.
The sword isnt just doing anything.
I hope anyone can help me fix this problem.
local player = game:GetService("Players").LocalPlayer
local char = player.Character
local slashAnim = script.Parent:FindFirstChild("SlashOne")
local slashPlay = char.Humanoid:LoadAnimation(slashAnim)
local canSlash = true
local debounce = 1
script.Parent.Activated:Connect(function()
if canSlash then
canSlash = false
slashPlay:Play()
wait(debounce)
canSlash = true
end
end)
Im not the best in animation in general but I think you have to load a animation from the animator.
local player = game:GetService("Players").LocalPlayer
local char = player.Character
local slashAnim = script.Parent:FindFirstChild("SlashOne")
local slashPlay = char.Humanoid:WaitForChild("Animator"):LoadAnimation(slashAnim)
local canSlash = true
local debounce = 1
script.Parent.Activated:Connect(function()
if canSlash then
canSlash = false
slashPlay:Play()
wait(debounce)
canSlash = true
end
end)
Hey,
its not an issue in the animations.
They´re working fine but the tool isn´t activating in the starterpack.
I tried to just use print(âActivatedâ) but it´s not giving anything but if i put it in the workspace and collect it then it´s working absolutely fine.
I found the issue.
I got an error in the script but it was actually hidden because i had a plugin that injected my scripts with a virus but i deleted it now.
So this is the error:
Players.PokeCardDealer.Backpack.ClassicSword.LocalScript:4: attempt to index nil with âHumanoidâ - Client - LocalScript:4