Just wondering. Making a staff which shoots a ball of magical DEATH.
✓ ANSWER ACCEPTED
Which bodyforce is best for Bullets, Flying balls, etc?
1 answer
✓ Accepted answer
Your best bet is probably going to be BodyVelocity. BodyVelocity sends the object at a certain speed in a certain direction. These are both determined in the same value "Velocity", which is sort of like the slope in three dimensions. This is the best choice, unless you want them to be homing missiles or include acceleration.
Here's an example of how to create your missile:
--local script in StarterGui
local player = game.Players.LocalPlayer --define the player
local character = player.Character --define the character
local mouse = player:GetMouse() --define the player's mouse
local missile = Instance.new("Part") --define our missile
missile.Shape = 0
missile.BrickColor = BrickColor.new("Dark indigo")
missile.Transparency = .5
missile.Size = Vector3.new(1,1,1)
missile.TopSurface = "Smooth"
missile.BottomSurface = "Smooth"
local f = Instance.new("Fire",missile)--add fire trail
f.Color = Color3.new(1,0,1)
f.SecondaryColor = Color3.new(1,0,1)
mouse.Button1Down:connect(function()--fire function when player clicks mouse
local start = character.Head.Position + Vector3.new(0,3,0) --where we want the missile to start at, 3 studs above the player's head
local target = mouse.Hit.p --the location the mouse is pointing at
local clone = missile:Clone() --clone the missile
local bv = Instance.new("BodyVelocity",clone) --create our body velocity
bv.Velocity = (target - start).unit*50 --change the velocity value
--(target - start).unit is the direction we want to fire the missile at, and *50 is the speed we want it to travel at.
clone.Touched:connect(function(hit)--fire function when missile is touched
if hit:IsDescendantOf(character) then--fire given code if touched part is a descendant of the character who fired the missile
return--terminate code
end
local b = Instance.new("Explosion")--create explosion
b.Position = clone.Position--position explosion at missile
b.Parent = workspace--put explosion in workspace
clone:Destroy()--destroy missile
end)
clone.CFrame = CFrame.new(start,target)*CFrame.Angles(math.rad(90),0,0) --Positions the missile above the player. We don't have to rotate it, but it prevents the fire from looking odd as the missile travels.
clone.Parent = workspace --put missile in the workspace
wait(10)--yield code for 10 seconds
if clone then--if missile still exists then fire given code
local b = Instance.new("Explosion")--create explosion
b.Position = clone.Position--position explosion at missile
b.Parent = workspace--put explosion in workspace
clone:Destroy()--destroy missile
end
end)
1 comment
0
I made you an example you could look to if you were having trouble
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
Bodythrust.
Does bodythrust send it flying a specific vector?
bodythrust sends it in the specified direction relevant to the part. you're better off with bodyvelocity
Ah, thanks. Wouldnt wanna be forced to rotate the ball every time, lol.