For some reason this shotgun effect for i = 1,12 do will work for this older RRP Shotgun script, but not for my newer edited one. I placed the loop code in the same spot, but it doesn’t work. Help?
Old RRP1 Shotgun Code:
if MyMouse then
for i = 1,12 do
local targetPoint = MyMouse.Hit.p
local shootDirection = (targetPoint - Handle.Position).unit
-- Adjust the shoot direction randomly off by a little bit to account for recoil
shootDirection = CFrame.Angles((0.5 - math.random()) * 2 * Spread,
(0.5 - math.random()) * 2 * Spread,
(0.5 - math.random()) * 2 * Spread) * shootDirection
local hitObject, bulletPos = RayCast(Handle.Position, shootDirection, Range)
local bullet
Newer FE Code:
if MyMouse then
RecoilTrack:Play()
local targetPoint = MyMouse.Hit.p
local shootDirection = (targetPoint - Handle.Position).unit
-- Adjust the shoot direction randomly off by a little bit to account for recoil
shootDirection = CFrame.Angles((0.5 - math.random()) * 2 * Spread,
(0.5 - math.random()) * 2 * Spread,
(0.5 - math.random()) * 2 * Spread) * shootDirection
Camera.CFrame = Camera.CFrame * CFrame.Angles(0.35,math.rad(0),0)
local hitObject, bulletPos = RayCast(Handle.Position, shootDirection, Range)
local bullet
for i = 1, 12 do
if MyMouse then
RecoilTrack:Play()
local targetPoint = MyMouse.Hit.p
local shootDirection = (targetPoint - Handle.Position).unit
-- Adjust the shoot direction randomly off by a little bit to account for recoil
shootDirection = CFrame.Angles((0.5 - math.random()) * 2 * Spread,
(0.5 - math.random()) * 2 * Spread,
(0.5 - math.random()) * 2 * Spread) * shootDirection
Camera.CFrame = Camera.CFrame * CFrame.Angles(0.35,math.rad(0),0)
local hitObject, bulletPos = RayCast(Handle.Position, shootDirection, Range)
local bullet
end