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

Fireball stays still and rotates when using BodyVelocity?

So I'm trying to make a Spell.Everything works but the spell doesnt move correctly. Please help.

local slash = game.ReplicatedStorage.Slash
local root = script.Parent.HumanoidRootPart
local view = root.CFrame.LookVector

script.RemoteEvent.OnServerEvent:Connect(function()
	local clone = slash:Clone()
	clone.CFrame = root.CFrame
	clone.Position = root.Position 
	clone.Parent = workspace
	clone.BodyVelocity.Velocity = Vector3.new(view * 250)
end)

this is inside a script. I just need it to move correctly.

1 answer

✓ Accepted answer

1.Instead of Vector3.new(view * 250) Use root.CFrame.LookVector

  1. Set the maxforce to something high!

Script:

local slash = game.ReplicatedStorage.Slash
local root = script.Parent.HumanoidRootPart
local view = root.CFrame.LookVector
local distance_in_studs = 100
 
script.RemoteEvent.OnServerEvent:Connect(function()
	local clone = slash:Clone()
	clone.CFrame = root.CFrame
	clone.Position = root.Position
	clone.Parent = workspace
	clone.BodyVelocity.MaxForce = Vector3.new(5000,5000,5000)
	clone.BodyVelocity.Velocity = root.CFrame*(root.CFrame.LookVector*distance_in_studs)
end)

2 comments

0

Thank you very much. You are a life saver.

0

No problem :)

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