Scripting Shotguns

Hi, I have a question about making a shotgun. Would the bullet spread use math.Random with CFrame values or is there another way to do it. I haven’t made it yet but I just want to prepare before I do anything. This is my first time scripting guns. Here’s what I’ve done so far


Woah, Nice job. If you ever are available ill hire you to remake Mario-Kart in Roblox with me.

I don’t think using a random value would be the best idea, as in certain situations awkward things can happen. I dont know of other ways to do it, but you could take apart the script of a free model shotgun and see how they did it.


If your guns are using raycasing, you could just add this to the cframe:

local spread = math.random(-90,90)
raycast * CFrame.Angles(0, math.rad(spread), math.rad(spread))

That will give you a random number between -90 and 90. That will rotate the original vector by that many degrees.


Thank you for the reply but is there any other way that I may be unaware of(I was planning to do the cframe option before)

1 Like