Im making a dual wielding gun tool, but I'm trying to figure out how to make it shoot at the same time. Can someone tell me? CODE:
local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit * 300) local touch, position = workspace:FindPartOnRay(ray, game.Players.LocalPlayer.Character, false, true) local trace = Instance.new("Part") trace.Anchored = trace trace.CanCollide = false trace.Transparency = 0.5 trace.BrickColor = BrickColor.new("Black") trace.Material = Enum.Material.SmoothPlastic local distance = (tool.Handle.CFrame.p - position).magnitude trace.Size = Vector3.new(0, 0, distance) trace.CFrame = CFrame.new(tool.Handle.CFrame, position) * CFrame.new(0, 0, -distance / 2) trace.Parent = workspace
I am assuming you mean shooting two seperate bullets at the same time from TWO SEPERATE guns, just in the same tool(1 tool, a gun model for each arm). What you could do is just copy and paste your code creating the Ray and the visible part. However, you would see both rays in the same spot, so you wouldn’t really see both. You need to create one Ray from a part on the tip of 1 gun all the way to the mouse, and one Ray from the tip of 2 gun to the mouse, and then have the visible part for each Ray. This would essentially be the same code as you have above, just one for each gun model, but in the same tool. Make sense?