https://gyazo.com/a8acf04ab08a2a77d69fc985fc51d0fe

function RayTouched(Hit, Position)
	if not Hit or not Hit.Parent then
		return
	end
	local character = Hit.Parent
	if character:IsA("Hat") then
		character = character.Parent
	end
	if character:IsA("Part") or character:IsA("MeshPart") then --Me Trying
		local part = character --Me Trying
		local humanoid = part.Parent:FindFirstChild("Humanoid") --Me Trying
		if not humanoid then --Me Trying
			humanoid = part.Parent.Parent.Parent:FindFirstChild("Humanoid") --Me Trying
		end--Me Trying
		if humanoid then --Me Trying
			character = part.Parent.Parent.Parent --Me Trying
		end--Me Trying
	end --Me Trying
	if character == Character then
		return
	end
	local humanoid = character:FindFirstChild("Humanoid")
	local SoundChosen = Sounds.RayHit
	if not humanoid or humanoid.Health == 0 then
		return
	end
	local player = Players:GetPlayerFromCharacter(character)
	if player and Functions.IsTeamMate(Player, player) then
		return
	end
	Spawn(function()
		IconChangeTick = tick()
		wait(1)
		if (tick() - IconChangeTick) >= 0.95 and ToolEquipped and PlayerMouse then
		end
	end)
end

This is where is gets the character I've tried to make it so it works, and its still not working.