Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make bullet spread my guns?

Asked by 3 years ago

Hey, I am trying to create bullet spread on my weapons. Here is a snipet of my serverside code

local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {player.Character}
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist

local randomPos = mousePos * math.random(-10,10) * math.pi -- my attempt at bulletspread

print(randomPos)
local raycastResult = workspace:Raycast(script.Parent.Barrel.Position, (randomPos -script.Parent.Handle.Position)*range, raycastParams) --- the ray

The ray is cast, and goes to the location of the mouse, but there is bullet spread.

Answer this question