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

Why doesn't the body velocity work for my fireball?

I'm trying to make a fireball spell. Everything works except the body velocity. The fireball just falls. It's unanchored and un-collided.

Local Script

local UIS = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local mouse = player:GetMouse()
local debounce = false

UIS.InputBegan:Connect(function(Input, IsTyping)
	if not IsTyping then
		if not debounce then
			debounce = true
			
			if Input.KeyCode == Enum.KeyCode.Z then
				game.ReplicatedStorage.Fireball:FireServer(mouse.Hit.Position)
			end
			
			wait(0.1)
			debounce = false		
		end
	end
end)

Server Script

local fireball = game.ServerStorage:WaitForChild("Fireball")

game.ReplicatedStorage.Fireball.OnServerEvent:Connect(function(player, mousePos)
	
	local character = player.Character
	local newFireball = fireball:Clone()
	
	newFireball.Position = character.HumanoidRootPart.Position
	newFireball.Parent = workspace
	local velocity = Instance.new("BodyVelocity", newFireball)
	print(newFireball.Position)
	velocity.Velocity = CFrame.new(newFireball.Position, mousePos).LookVector * 250
end)

1 answer

✓ Accepted answer

Make the max force larger on the body velocity.

velocity.MaxForce = Vector3.new(4000,math.huge,4000)

I don't remember if you have to change Y force or only X and Z force but if you will play with it you will find out i think.

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