Hello, we are making a shotgun with a random offset for each raycast, not depending on which direction you look, it becomes extremely horizontal, sometimes extremely vertical, unless you move your camera inbetween these directions
Code:
tool.Activated:Connect(function()
if ready == true and tool:GetAttribute("fullAuto")==false and game.Players.LocalPlayer:GetAttribute("characterLoaded") then
if canfire == true and Ammo>0 and Reloading==false then
Ammo-=1
AmmoWrapper.AmmoLabels.Text=tostring(Ammo).."/"..tostring(tool:GetAttribute("maxAmmo"))
canfire = false
if tool:GetAttribute("shotgun") then
count=tool:GetAttribute("pellets")
else
count=1
end
while count~=0 do
local camera =workspace.CurrentCamera
local cameraCF = camera.CFrame
local Offset = Vector3.new(
math.random(-Spread*100,Spread*100)/10,
math.random(-Spread*100,Spread*100),
math.random(-Spread*100,Spread*100)
)/300
fireRemote:FireServer(cameraCF.Position,((cameraCF.LookVector * Offset)+cameraCF.LookVector)*lenght,dmg,tool)
count-=1
end
wait(tool:GetAttribute("cooldown"))
canfire = true
end
else
Looking the opposite way:
Looking inbewteen these directions: