I am currently working on a pistol, and I'm wondering on how I can add a bullet hole portion to this script. Basically, it'll make a bullet hole wherever the bullet hits on impact, except for parts within humanoid models, which will be another texture. If someone can help me, it'd be a lot of help. Thanks!
Tool = script.Parent
colors = {26,}
function fire(v)
if (script.Parent.AmmoScript.Clip.Value == 0) then return
end
script.Parent.AmmoScript.Clip.Value = script.Parent.AmmoScript.Clip.Value - 1
print(Ammo)
Tool.Handle.Fire:play()
Tool.Parent.Torso:findFirstChild("Right Shoulder").CurrentAngle = 2
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 * 200 + Vector3.new(math.random(-1,0),math.random(-1,0),math.random(-1,0))
missile.BrickColor = BrickColor.new(colors[math.random(1, #colors)])
missile.Shape = 0.5
missile.BottomSurface = 0
missile.TopSurface = 0
missile.Name = "Bullet"
missile.Elasticity = 0
missile.Reflectance = .1
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_mesh = script.Parent.Bullet:clone()
new_mesh.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
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
fire(lookAt)
wait(0.15)
Tool.Enabled = true
end
script.Parent.Activated:connect(onActivated)

1 comment
If you're not going to answer my question, you don't have to write anything at all.