I am making a gun using raycasting, and i want to be able to make shotguns work like they do in other games. I already tried to write code to do this, but it spreads the same reguardless of distance. What should I do?
My spread code that i use for the shotgun:
local function doSpread(bool) local spread = gunSettings.Spread local random = Random.new() if bool or gunSettings.SpreadEnabled then return mouse.Hit*CFrame.new(random:NextNumber(-spread,spread),random:NextNumber(-spread,spread),0) else return mouse.Hit end end