So, I'm making this script in which the player has to have an axe in order to interact with the tree. Here's my script:
local player = game.Players.PlayerAdded:Wait()
local character = player.Character or player.CharacterAdded:Wait()
while not character.Parent do
character.AncestryChanged:Wait()
end
local Humanoid = character:WaitForChild('Humanoid')
local HRP = character:WaitForChild('HumanoidRootPart')
local mouse = player:GetMouse()
local Anim = Instance.new("Animation",script.Parent)
Anim.Name = "ChopAnim"
Anim.AnimationId = 'rbxassetid://3027147369'
local Animation = Humanoid:LoadAnimation(Anim)
local Part = script.Parent
local Tool = player.Backpack:WaitForChild('[LUMBERJACK] Axe')
game.ReplicatedStorage.PressedE.OnServerEvent:Connect(function()
Tool.Equipped:Connect(function()
if (HRP.Position - Part.Position).magnitude < 4.5 then
Humanoid.WalkSpeed = 0
Humanoid.JumpPower = 0
Animation:Play()
end
end)
end)
However, It's not working. I think there is some hidden way to do it, and I do not know that.
Any help please?

4 comments
you can check if the tools's parent is player's character
you can check if the tools's parent is player's character
You can check it with the "equipped" function. And make a if statement if its a character then print something or something like that.
Nope. Doesn't work.