The script works if i make it with while loop instead of playeradded function but i don’t want make it loop. It hurts the animation.
So why it won’t work?
local character = game:GetService("Players").LocalPlayer.Character
local tool = script.Parent
local animation = tool:WaitForChild("Animation")
local animationTrack = character.Humanoid:LoadAnimation(animation)
local canRun = true
local debounceTime = 2
game.Players.PlayerAdded:Connect(function(plr)
if tool.Unequipped then
character:FindFirstChild("Humanoid"):EquipTool(tool)
end
end)
local Players = game:GetService('Players')
Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local tool = plr.Backpack:FindFirstChild("ToolName") or char:FindFirstChild("ToolName")
local humanoid = char:FindFirstChildOfClass("Humanoid")
humanoid:EquipTool(tool)
end)
end)```