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

Why are my bullet casings not coming out of the gun?

Asked by 5 years ago
local function shoot()
    --//Initialize
    if not canShoot(player, true) then return end
    shootSound:Play()
local bullet = game:GetService("ServerStorage")
local bullet2 = bullet:WaitForChild("9mm")
local cloneBullet = bullet2:Clone()
cloneBullet.Parent = script.Parent.Parent.shell
cloneBullet.Position = Vector3.new(cloneBullet.Parent)
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

0
Shouldn't you be setting the position to cloneBullet.Parent.Position? Synth_o 136 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

The problem is that you're using the cloneBullet's parent object and not it's actual position:

local function shoot()
    --//Initialize
    if not canShoot(player, true) then return end
    shootSound:Play()
local bullet = game:GetService("ServerStorage")
local bullet2 = bullet:WaitForChild("9mm")
local cloneBullet = bullet2:Clone()
cloneBullet.Parent = script.Parent.Parent.shell
cloneBullet.Position = Vector3.new(cloneBullet.Parent.Position) -- changed it here
end
Ad

Answer this question