How to get own player team from tool?

Hello, does anyone know how to get the player’s own team through the tool using server script? I tried to use many ways to get my player but couldn’t. I just need to find out my player’s team through the toolusing server script. Please, can someone help me?

debounce = false
local CanAttack = false
local Sword = script.Parent.Parent
local HitBox = script.Parent
local MyPlayer = How?

Sword.Activated:Connect(function(Activated)
if CanAttack == false then
CanAttack = true
	end
end)

HitBox.Touched:Connect(function(Hit)
	if CanAttack == true then
		if debounce == false then
		local HitHumanoid = Hit.Parent:FindFirstChild("Humanoid")
			local HitedPlayer = game.Players:GetPlayerFromCharacter(Hit.Parent)
			if HitHumanoid then
				if MyPlayer.Team ~= HitedPlayer.Team then
				HitHumanoid:TakeDamage(12.5)
					debounce = true
					wait(0.875)
					CanAttack = false
					debounce = false
				end
			end
		end
	end
end)

Why dont u just insert StringValue into the tool and check the value later on?

U would just do Players:GetPlayerFromCharacter(script.Parent.Parent)

Assuming the script is direct child of the tool

But I have a script for damage, and when I write player = script.Parent.Parent I will get my Character, bacause it in my character or am I wrong?

If the script is in your Character, then it should be script.Parent

But I kind of need a player to get to know the team

i got error: attempt to index nil with ‘Team’

debounce = false
local CanAttack = false
local Sword = script.Parent.Parent
local HitBox = script.Parent
local MyPlayer = script.Parent.Parent:WaitForChild("MyPlayer")

MyPlayer.Changed:Connect(function()
	MyPlayer.Value = MyPlayer.Value 
end)
print(MyPlayer.Value)

Sword.Activated:Connect(function(Activated)
if CanAttack == false then
CanAttack = true
	end
end)

HitBox.Touched:Connect(function(Hit)
	if CanAttack == true then
		if debounce == false then
		local HitHumanoid = Hit.Parent:FindFirstChild("Humanoid")
			local HitedPlayer = game.Players:GetPlayerFromCharacter(Hit.Parent)
			if HitHumanoid then
				print(MyPlayer.Value)
				if MyPlayer.Value.Team ~= HitedPlayer.Team then
				HitHumanoid:TakeDamage(12.5)
					debounce = true
					wait(0.875)
					CanAttack = false
					debounce = false
				end
			end
		end
	end
end)

value script -

game.Players.PlayerAdded:Connect(function(Player)
local Value = script.Parent
Value.Value = Player.Name
end)

Players:GetPlayerFromCharacter(script.Parent.Parent)

Should work if the Script is inside your tool.

Now I just can’t even do damage

debounce = false
local CanAttack = false
local Sword = script.Parent.Parent
local HitBox = script.Parent
local Character = script.Parent.Parent.Parent
local MyPlayer = game.Players:GetPlayerFromCharacter(script.Parent.Parent.Parent)

Sword.Activated:Connect(function(Activated)
if CanAttack == false then
CanAttack = true
	end
end)

HitBox.Touched:Connect(function(Hit)
	if CanAttack == true then
		if debounce == false then
		local HitHumanoid = Hit.Parent:FindFirstChild("Humanoid")
			local HitedPlayer = game.Players:GetPlayerFromCharacter(Hit.Parent)
			if HitHumanoid then
				if MyPlayer.Team ~= HitedPlayer.Team then
				HitHumanoid:TakeDamage(12.5)
					debounce = true
					wait(0.875)
					CanAttack = false
					debounce = false
				end
			end
		end
	end
end)

Screenshot_2