This is my script(not full script)
if ray then
bullet:Destroy()
local hit = ray.Instance
local hole = game.ReplicatedStorage.Holes.Concrete:Clone()
hole.Name = "BulletHole"
hole.Parent = workspace.BulletHoles
hole.Position = mousePos
hole.CFrame = CFrame.new(hole.Position,rayPos + lastPos)
local weld = Instance.new("Weld")
weld.Part0, weld.Part1 = hit,hole
weld.C0 = hit.CFrame:Inverse()
weld.C1 = hole.CFrame:Inverse()
weld.Parent = hole
game:GetService("Debris"):AddItem(hole,8)
local model = hit:FindFirstAncestorOfClass("Model")
if model then
local humanoid = model:FindFirstChildWhichIsA("Humanoid") or nil
if humanoid then
if hit.Name == "Head" then
humanoid:TakeDamage(math.random(100,112))
hole:Destroy()
else
humanoid:TakeDamage(math.random(37,52))
hole:Destroy()
end
end
end
task.spawn(function()
task.wait()
task.wait()
tracer.Position = Vector3.new(0,1e7,0)
tracer.Parent = workspace.VisualStorage
end)
break
end
if bullet.Parent == nil then
bullet:Destroy()
break
end
lastPos = bullet.Position
end
I’m tried to use local hit,pos,normal but this won’t work in my script. Because hit = ray.Instance