I'm making a gun and when the gun shoots this script is put into the bullet when the bullet hits an object it should create a black part that gets stuck inside the object but it doesn't for some reason?
it instead spawns ontop of the object it hit i'm pretty sure it has something to do with line 13 even though it doesn't give me an error in the output..
here's my script
script.Parent.Touched:connect(function(hit)
if hit.Parent.Humanoid then
hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health -10
end
end)
--beyond this point is an error be careful!
script.Parent.Touched:connect(function(hit)
local p = Instance.new("Part", workspace)
p.Position = script.Parent.Position
p.FormFactor = "Custom"
p.Size = Vector3.new(0.2, 0.2, 0.2)
p.Color = Color3.new(0, 0, 0)
p.CFrame = p.CFrame + p.CFrame.lookVector * 0.195
p.Anchored = true
end)

3 comments
It still goes to the top of the part but not as high now
I fixed It thanks to you :D
No problem.