Hello, I'm trying to make a simple gun script for a tool in StarterPack.
local tool = script.Parent
local dollarbill = game.ServerStorage.DollarBill
local dspawnpos = script.Parent.Shadow.Position
local bodypos = Instance.new("BodyPosition")
local bulletyo = script.Parent:FindFirstChild("bulletyo")
script.Parent.Activated:connect(function(fire)
if (bulletyo == nil) then
bulletyo = dollarbill:Clone()
bulletyo.Position = Vector3.new(dspawnpos)
bulletyo.Velocity = Vector3.new(50,50,50)
bodypos.Parent = bulletyo
bodypos.MaxForce = Vector3.new(0,98,0)
print("Not a single error.")
end
end)
It prints "Not a single error." just once after I click, but the script is not actually doing what its supposed to. However, in the output I get that "Shadow", which is a part somewhere in the tool is not a valid member of Backpack. Am I doing this wrong?

1 comment
You're not parenting bulletyo to anything, hence bulletyo is effectively parented to nil.