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

Help with creating bullets?

Instead of using raycast, I'd like to create a bullet that moves through the air as it is shot, instead of being directly hit like a raycast. Where do I start?

1 answer

✓ Accepted answer

For this then you could either use BodyThrust, or BodyPosition with the Bullet part. The latter is preferred. When you 'fire' the gun then you can create a part, set it's CFrame relative to the handle and then put BodyPosition in it, with the 'position' property set to the Mouse's hit position.

Example;

local plr = game.Players.LocalPlayer
local mouse =  plr:GetMouse()

mouse.Button1Down:connect(function()
	local pos = mouse.Hit.p
	--Part Creation--
	local b = Instance.new("BodyPosition", CreatedPart)
	b.position = pos
end)

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