here's the script for the launcher... plz tell me how I can make it go at barrel position, cos the aim part is at left, so its at middle of screen, and thats were the cursor is, so thats were it shoots, but I want it to be like real... so u aim thre but u shoot there... if u know wat I mean...

r = game:service("RunService")

shaft = script.Parent
position = shaft.Position
car = false
lol = false

script.Parent.Explosion.PlayOnRemove = true -- play explosion sound when projectile removed from game


function blow()
	explosion = Instance.new("Explosion")
	explosion.Position = shaft.Position
	explosion.BlastPressure = 2500
	explosion.BlastRadius = 25


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


	explosion.Parent = game.Workspace
	connection:disconnect()
	wait(.1)
	shaft:remove()
end

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

function doDamage(part, distance)
	
	if part.Name == "Regen" then return end

	if part.Parent.className == "Tool" then return end
	if part.Parent.className == "Hat" then return end

	if part.Parent:findFirstChild("ShellShocked") ~= nil then return end
	if part.Parent:findFirstChild("ForceField") ~= nil then return end

	if part.Name == "Head" then
		local humanoid = part.Parent.Humanoid
		humanoid.Health = humanoid.Health - (100 - distance)
		local ss = Instance.new("IntValue")
		ss.Parent = part.Parent
		ss.Name = "ShellShocked"
		game:getService("Debris"):addItem(ss,2)
	end
end


function tagHumanoid(humanoid, creator)
	-- tag does not need to expire iff all explosions lethal
	
	if creator ~= nil then
		local new_tag = creator:clone()
		new_tag.Parent = humanoid
		
	end
end

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

t, s = r.Stepped:wait()

d = t + 9999999999 - s
connection = shaft.Touched:connect(blow)

while t < d do
	t = r.Stepped:wait()
end

-- at max range
blow()
script.Parent.Explosion.PlayOnRemove = false
shaft:remove()

2 comments

0

I'd really love if you gave me key parts to look at.

0

u mean like parts with names? lik handle, aimpart and all them?