--function untagHumanoid(humanoid)
--	if humanoid ~= nil then
--		local tag = humanoid:findFirstChild("creator")
--		if tag ~= nil then
--			tag.Parent = nil
--		end
--	end
--end


function explode()
	local explosion = Instance.new("Explosion")
	local blastradius=5
	explosion.BlastRadius = blastradius
	explosion.BlastPressure = 10000 -- 10k
	explosion.DestroyJointRadiusPercent = math.random(0,20)/100
	explosion.ExplosionType = 'CratersAndDebris'
	--explosion.Visible = false
	explosion.Position = script.Parent.Position
	explosion.Parent = game.Workspace
	
	explosion.Hit:connect(function(hitPart, hitDistance)
		local humanoid = hitPart.Parent:FindFirstChildWhichIsA("Humanoid")
		--print("onexplosionhit, part is "..hitPart.Name)
		--if character then
		--	local myPlayer = CreatorTag.Value
		--	if myPlayer and not myPlayer.Neutral then -- Ignore friendlies caught in the blast
		--		local player = PlayersService:GetPlayerFromCharacter(character)
		--		if player and player ~= myPlayer and player.TeamColor == Rocket.BrickColor then
		--			return
		--		end
		--	end
		--end

		if humanoid and humanoid.Health > 0 and hitPart.Name==("Torso") then -- Humanoids are tagged and damaged
			local dmg=math.random(40,50)
			dmg=dmg*(hitDistance/blastradius)
			humanoid:TakeDamage(dmg)
			print("dealt "..dmg.." damage to "..hitPart.Parent.Name)
		end
	end)
end

connection = ball.Touched:connect(onTouched)
