if ToolMode=="\084\111\111\108"then if Tool.Parent and Tool.Parent:IsA("\066\097\099\107\112\097\099\107")then Player=Tool.Parent.Parent elseif Tool.Parent and Tool.Parent:IsA("\077\111\100\101\108")then Player=Players:GetPlayerFromCharacter(Tool.Parent)else Player=nil end Tool.AncestryChanged:Connect(function(z,T)if z~=Tool then return end if T and T:IsA("\066\097\099\107\112\097\099\107")then Player=T.Parent elseif T and T:IsA("\077\111\100\101\108")then Player=Players:GetPlayerFromCharacter(T)else Player=nil end end)end

if ToolMode == 'Tool' then

	-- Set current player if in backpack
	if Tool.Parent and Tool.Parent:IsA 'Backpack' then
		Player = Tool.Parent.Parent;

	-- Set current player if in character
	elseif Tool.Parent and Tool.Parent:IsA 'Model' then
		Player = Players:GetPlayerFromCharacter(Tool.Parent);

	-- Clear `Player` if not in possession of a player
	else
		Player = nil;
	end;

	-- Stay updated with latest player operating the tool
	Tool.AncestryChanged:Connect(function (Child, Parent)

		-- Ensure tool's parent changed
		if Child ~= Tool then
			return;
		end;

		-- Set `Player` to player of the backpack the tool is in
		if Parent and Parent:IsA 'Backpack' then
			Player = Parent.Parent;

		-- Set `Player` to player of the character holding the tool
		elseif Parent and Parent:IsA 'Model' then
			Player = Players:GetPlayerFromCharacter(Parent);

		-- Clear `Player` if tool is not parented to a player
		else
			Player = nil;
		end;

	end);

end;
