my gun instances 3 bullets at once, but I put the line "instance" once? this might be a glitch.
gunEvent.OnServerEvent:Connect(function(plr, mouse)
local par = RaycastParams.new()
par.FilterDescendantsInstances = {plr.Character}
par.FilterType = Enum.RaycastFilterType.Blacklist
local ori = script.Parent.Handle.Position
local direc = (mouse - ori) * 300
local res = workspace:Raycast(ori, direc, par)
if res and deb == true then
deb = false
local res2 = res.Instance
local mod = res2:FindFirstAncestorOfClass("Model")
local distance = (ori - res.Position).Magnitude
local p = Instance.new("Part")
p.Color = Color3.fromRGB(255, 255, 127)
p.Massless = true
p.Anchored = true
p.CanCollide = false
p.Size = Vector3.new(0.1, 0.1, distance)
p.CFrame = CFrame.lookAt(ori, res.Position)*CFrame.new(0, 0, -distance/2)
p.Parent = workspace
I called instance once, but it spawned 3 bullets why? the rest of the script is about damaging humanoids. I even checked the whole script by doing find all, nothing. is there a problem? it used to spawn 2 bullets, now 3. ill summarize it for you. i put Instance.new("Part") once but it did it three times. i have a debounce to stop it from repeating. whats happening? i also checked CTRL + SHIFT + F and found nothing containing Instance.new("Part") except this line.

1 comment
what does it look like