Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

1 comment

0

Shouldn't you be setting the position to cloneBullet.Parent.Position?

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.