Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to merge these two scripts together?

One is an advanced Bullet Hole/blood splat system I made, and the other one is the projectile script.

V Bullet hole/Blood

enabled = true
splat_id = "http://www.roblox.com/asset/?id=29350583"
hole_id = "http://www.roblox.com/asset/?id=30217567"
hitHum = false



function texture(part,pos,surface,id,size)
	if (part) then
		--Enum.NormalId.Top
		local p = Instance.new("Part")
		p.formFactor = 0
		p.Size = Vector3.new(1,1,1)
		p.CFrame = part.CFrame
		p.Anchored = true
		p.Transparency = 1
		p.CanCollide = false
		p.Parent = part.Parent
		local m = Instance.new("BlockMesh")
		m.Parent = p
		m.Offset = relpos(pos,part)
		local d = Instance.new("Decal")
		d.Face = surface
		d.Texture = id
		d.Parent = p
		game:GetService("Debris"):AddItem(p,1200)
		if (surface == Enum.NormalId.Top or surface == Enum.NormalId.Bottom) then
			m.Scale = Vector3.new(size,0,size)
		end
		if (surface == Enum.NormalId.Left or surface == Enum.NormalId.Right) then
			m.Scale = Vector3.new(0,size,size)
		end
		if (surface == Enum.NormalId.Front or surface == Enum.NormalId.Back) then
			m.Scale = Vector3.new(size,size,0)
		end
		if (not part.Anchored) then
			p.Anchored = false
			local w = Instance.new("Weld")
			w.Part0 = part
			w.Part1 = p
			w.Parent = part
		end
	end
end



		local a = targ.Parent:children()
		local b = 0
		hitHum = false
		for b = 1, #a do 
			if (a[b]:IsA("Humanoid")) then 
				a[b].Health = a[b].Health - 50/((Hit.p - mouse.hit.p).magnitude/5)
				hitHum = true 
				local c = Instance.new("ObjectValue")
				c.Name = "creator"
				c.Value = game.Players.LocalPlayer
				c.Parent = a[b]
			end 
		end

		if (hitHum and targ.Parent ~= workspace) then
			local parent = targ.Parent.Parent
			targ.Parent.Parent = Tool.Parent
			local targ2 = mouse.Target
			local pos = mouse.Hit.p
			local surface = mouse.TargetSurface
			targ.Parent.Parent = parent
			texture(targ2,pos,surface,splat_id,2)
			texture(targ,mouse.Hit.p,mouse.TargetSurface,splat_id,0.5)
		else
			texture(targ,mouse.Hit.p,mouse.TargetSurface,hole_id,0.5)
		end

V Projectile script

Tool = script.Parent

colors = {2, 0, 0}

function fire(v)

	Tool.Handle.Fire:play()
	

	local vCharacter = Tool.Parent
	local vPlayer = game.Players:playerFromCharacter(vCharacter)

	local missile = Instance.new("Part")

        

	local spawnPos = vCharacter.PrimaryPart.Position
	


	spawnPos  = spawnPos + (v * 8)

	missile.Position = spawnPos
	missile.Size = Vector3.new(1,1,1)
	missile.Velocity = v * 900
	missile.BrickColor = BrickColor.new(colors[math.random(1, #colors)])
	missile.Shape = 0
	missile.BottomSurface = 0
	missile.TopSurface = 0
	missile.Name = "Paintball"
	missile.Elasticity = 0
	missile.Reflectance = 0
	missile.Friction = .3

	local force = Instance.new("BodyForce")
	force.force = Vector3.new(0,100,0)
	force.Parent = missile
	
	Tool.BrickCleanup:clone().Parent = missile

	local new_script = script.Parent.Paintball:clone()
	new_script.Disabled = false
	new_script.Parent = missile

	local creator_tag = Instance.new("ObjectValue")
	creator_tag.Value = vPlayer
	creator_tag.Name = "creator"
	creator_tag.Parent = missile
	


	missile.Parent = game.Workspace
	--wait(0.05)
	--fire(
	

end


function check(en)
---------------------------------------Function start here.
if (Tool.Enabled == false) then
return false
end--end for if!
-------------------------------
if (Tool.Enabled == true) then
return true
end
---------------------------------------Function end here.
end


Tool.Enabled = true
function onActivated()

	if not Tool.Enabled then
		return
	end

	--Tool.Enabled = false

	local character = Tool.Parent;
	local humanoid = character.Humanoid
	if humanoid == nil then
		print("Humanoid not found")
		return 
	end

	local targetPos = humanoid.TargetPoint
	local lookAt = (targetPos - character.Head.Position).unit
	
	if (check()) then
	fire(lookAt)
	wait(0.001)
	onActivated()
	end
	return

	--Tool.Enabled = true
end


script.Parent.Activated:connect(onActivated)

1 answer

Sorry, but this website is to help scripters that are trying to code.

If you don't know how to "merge" those scripts then you definitely didn't write either of them. We're happy to help answer questions but we are not here to do work for you. Go try and learn instead of making others do your work.

This discussion is preserved as it was. New answers, comments, and votes are closed.