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

My gun using Instance.new() bullets won't move and simply fall, why Is that?

So there was a problem where a gun I'm making that uses Instance.new(), It works perfectly but the problem Is where I tried making a bodythrust via the shooting script and parented the bodythrust to the bullet (Which the bodythrust Is called "newBulletSpeed" and the bullet Iself "newBullet"). And as the title says, It doesn't move

script: Ignore the audio scripts, there not the problem

local tool = script.Parent
local music = tool:WaitForChild("Meme")
local equipsound = tool:WaitForChild("Equip")
local unequipped = tool:WaitForChild("Unequipped")
local pew = tool:WaitForChild("Pew")

tool.Equipped:Connect(function()
	music:Play()
	equipsound:Play()
end)

tool.Unequipped:Connect(function()
	music:Stop()
	unequipped:Play()
end)

tool.Activated:Connect(function()
	pew:Play()
	local newBullet = Instance.new('Part')
	local newBulletSpeed = Instance.new('BodyThrust')
	
	newBullet.Parent = game.Workspace
	newBulletSpeed.Parent = newBullet.Parent
	newBulletSpeed.Force = Vector3.new(3000,100,0)
	newBullet.Size = Vector3.new(1,1,1)
	newBullet.Position = script.Parent.Handle.Position
	newBullet.Orientation = script.Parent.Handle.Orientation
	newBullet.Touched:Connect(function(hit)
		local humanoid = hit.Parent:WaitForChild("Humanoid")
		if humanoid then
			humanoid:TakeDamage(5)
		end
	end)
	wait(1)
	newBullet:Destroy()
end)

1 answer

On line 23 you parent the BodyThrust object to the workspace, I'm pretty sure you want the thrust to be applied to the bullet, which is unanchored, try this on line 23: newBulletSpeed.Parent = newBullet. I hope this helped! If it solved the problem please mark it as the answer, otherwise comment on this so we can figure something out! Good Luck

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