I’ve been working on my Gun System until I tried to finish up the visuals and for the smoke effect I was using the OTS Gun Systems code. And when I put it into my script it gave me the error “attempt to call a number value”
-- Error: Players.talkingpotato5000.PlayerScripts.Client:149: attempt to call a number value
if material == Enum.Material.Brick or material == Enum.Material.Concrete or material == Enum.Material.Cobblestone or material == Enum.Material.SmoothPlastic then
local mat = game.ReplicatedStorage.Assets.Impact.Concrete
if mat then
local hole = Instance.new("Part", workspace)
local particles = mat:FindFirstChildWhichIsA("BasePart")
local tab = mat.Sounds:GetChildren()
local rs = tab[math.random(1, #tab)]
local cl = rs:Clone()
cl.Parent = hole
cl:Play()
if particles then
for i,v in pairs(particles:GetChildren()) do
if v:IsA("ParticleEmitter") then
local c = v:Clone()
c.Parent = hole
delay(0.1, function()
c.Enabled = false
end)
end
end
end
hole.Size = Vector3.new(0.7, 0.7, 0.001)
hole.Transparency = 1
hole.CanCollide = false
hole.Position = pos
hole.CFrame = CFrame.new(pos,pos+normal)
hole.Anchored = true
local decal = mat:FindFirstChildOfClass("Decal")
if decal then
local clone = decal:Clone()
clone.Parent = hole
end
game.Debris:AddItem(hole, 6)
end
end
end