01 | local function shoot() |
02 | --//Initialize |
03 | if not canShoot(player, true ) then return end |
04 | shootSound:Play() |
05 | local bullet = game:GetService( "ServerStorage" ) |
06 | local bullet 2 = bullet:WaitForChild( "9mm" ) |
07 | local cloneBullet = bullet 2 :Clone() |
08 | cloneBullet.Parent = script.Parent.Parent.shell |
09 | cloneBullet.Position = Vector 3. new(cloneBullet.Parent) |
10 | end |
That is the script that I made for my shell-ejecting gun, but whenever it fires, it just spawns out of the baseplate like this: https://gyazo.com/9fae49f8889371f201943f9e333813df
This should be simple to fix, thank you.
~IiNaoriku
The problem is that you're using the cloneBullet's parent object and not it's actual position:
01 | local function shoot() |
02 | --//Initialize |
03 | if not canShoot(player, true ) then return end |
04 | shootSound:Play() |
05 | local bullet = game:GetService( "ServerStorage" ) |
06 | local bullet 2 = bullet:WaitForChild( "9mm" ) |
07 | local cloneBullet = bullet 2 :Clone() |
08 | cloneBullet.Parent = script.Parent.Parent.shell |
09 | cloneBullet.Position = Vector 3. new(cloneBullet.Parent.Position) -- changed it here |
10 | end |