How to find who is using the tool

not printing anything, script:

local tr = true
local Player = game.Players.LocalPlayer
local Tool = script.Parent
local Script = script
local Animation =  Tool:WaitForChild("HitAnim1")
local HoldAnim = Tool:WaitForChild("HoldAnim")
local Character = Player.Character or Player.CharacterAdded:Wait()
local Hit1 = Character:FindFirstChildOfClass("Humanoid"):LoadAnimation(Animation)
local Hold = Character:FindFirstChildOfClass("Humanoid"):LoadAnimation(HoldAnim)
local PlayerEquiped = script.Parent.Parent.Parent
local Players = game:GetService("Players")

Tool.Equipped:Connect(function()
	Hold:Play()
end)

Tool.Activated:Connect(function()
	if tr == true then
		Hit1:Play() 
		script.Parent.Slash:Play()
		tr = false
		wait(0.5)
		tr = true
	end		
end)

Tool.Unequipped:Connect(function()
	Hold:Stop()
end)


Tool.Hitbox.Touched:Connect(function(hit)
	print("touched", hit)

	if hit.Parent:FindFirstChild("Humanoid") then
		-- It's a player
		local otherPlayer = Player:GetPlayerFromCharacter(hit.Parent)

		if otherPlayer then
			if otherPlayer.Team.Name ~= Player.Team.Name then 
				print(otherPlayer.Name, "is not on the same team.")
			end
		end
	end
end)

pictures containing the parts and stuff
Screenshot 2023-10-12 170012


video of me using it:

team script (just in case this has anything to do with it)

local teams = game:GetService("Teams"):GetChildren()
local team1 = game.Teams.Blue
local team = game.Teams.Red
local teamtrue = false

game.Players.PlayerAdded:Connect(function(player)
	if teamtrue == false then
		if player.Team == nil then
			player.Team = team
			teamtrue = true	
		end
	end
	if teamtrue == true then
		if player.Team == nil then
			player.Team = team1
			teamtrue = false
		end
	end
end)

That’s odd since it worked for me smoothly. I would try adding parts around the workspace to even see if it is getting touched any where else.

Also please ensure the tool has canTouch on.

look at the part you helped me with i cannot edit anymore today i have to go ofline please if you can wait till tomorrow

local tr = true
local Player = game.Players.LocalPlayer
local Tool = script.Parent
local Script = script


local Animation =  Tool:WaitForChild("HitAnim1")
local HoldAnim = Tool:WaitForChild("HoldAnim")
local Character = Player.Character or Player.CharacterAdded:Wait()
local Hit1 = Character:FindFirstChildOfClass("Humanoid"):LoadAnimation(Animation)
local Hold = Character:FindFirstChildOfClass("Humanoid"):LoadAnimation(HoldAnim)
local PlayerEquiped = script.Parent.Parent.Parent
local Players = game:GetService("Players")

Tool.Equipped:Connect(function()
	Hold:Play()
end)

Tool.Activated:Connect(function()
	if tr == true then
		Hit1:Play() 
		script.Parent.Slash:Play()
		tr = false
		wait(0.5)
		tr = true
	end		
end)

Tool.Unequipped:Connect(function()
	Hold:Stop()
end)


Tool.Hitbox.Touched:Connect(function(hit)
	print("touched", hit)

	if hit.Parent:FindFirstChild("Humanoid") then
		-- It's a player   -- i belive the problem is here where mine says player instead of players is -----that a problem?
		local otherPlayer = Player:GetPlayerFromCharacter(hit.Parent)

		if otherPlayer then
			if otherPlayer.Team.Name ~= Player.Team.Name then 
				print(otherPlayer.Name, "is not on the same team.")
			end
		end
	end
end)

I see the issue now, You need to use Players:GetPlayerFromCharacter(hit.Parent)