--wait()

local creator = script.Parent:findFirstChild("creator")
local move = script.Parent:findFirstChild("Move")

local active = true

function tagHumanoid(humanoid, creator)
	if creator ~= nil then
		local new_tag = creator:clone()
		new_tag.Parent = humanoid
	end
end

function onPlayerBlownUp(part, distance, creator)
	if part.Name == "Head" then
		local humanoid = part.Parent.Humanoid
		tagHumanoid(humanoid, creator)
	end
end

function set_Off(hit)
	if active == true then
		active = false
		explosion = Instance.new("Explosion")
		explosion.BlastRadius = 45
		explosion.BlastPressure = 50000

		local creator = script.Parent:findFirstChild("creator")
		if creator ~= nil then
			explosion.Hit:connect(function(part, distance)  onPlayerBlownUp(part, distance, creator) end)
		end

		explosion.Position = script.Parent.Position
		explosion.Parent = game.Workspace
		wait()
		script.Parent:remove()
	end
end
script.Parent.Touched:connect(set_Off)

for i = 1,100 do
	wait()
	local desired = Instance.new("Vector3Value")
	desired.Value = script.Parent.CFrame.lookVector * 2100

	local difference = desired.Value - move.velocity

	if difference.magnitude >= move.velocity.magnitude then
		move.velocity = move.velocity + (difference*(0.01*i))
	end
end
