Tutorial · Gameplay

How to make a fireball in Roblox Studio

A fireball is a projectile: something that flies across the map, hits whatever is in its way and hurts players near the impact. It is the base of every magic, ability and battlegrounds game. This guide builds it the safe way: the player's device only says where they are aiming, and the server checks the cooldown, spawns the fireball, moves it with a short raycast every frame and decides the damage.

Updated 14 November 20269 min readIntermediateLuauWritten by

In short

Make a Tool with a LocalScript that sends the mouse's aim point to the server through a RemoteEvent when the Tool is activated. In a Script in ServerScriptService, check the point and a cooldown, create an anchored, glowing ball in front of the player and move it a little every Heartbeat. Each frame, cast a ray along that small step. When the ray hits something, remove the ball, show an Explosion with no pressure and damage every character within the blast radius once.

  • The client sends only a position. Speed, damage, range and cooldown live on the server, so a cheater cannot change them.
  • A raycast per step catches thin walls and fast players that a Touched event would miss at high speed.
  • Set the Explosion's DestroyJointRadiusPercent to 0, or the explosion itself will kill everyone in range.

Get the script

Fireball projectile script (server)

One Script in ServerScriptService that checks the cooldown, spawns the fireball, moves it with raycasts and deals blast damage once per character.

Script in ServerScriptService named FireballService
-- Script in ServerScriptService named FireballService.
-- Checks each cast, then spawns, moves and explodes the fireball. The client only sends an aim point.
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")

local TOOL_NAME = "Fireball" -- the Tool the player must be holding
local REQUIRE_TOOL = true -- false for a key ability with no Tool (Step 4)
local COOLDOWN = 1.5 -- seconds between fireballs for one player
local SPEED = 80 -- studs per second
local MAX_RANGE = 300 -- studs before the fireball fizzles out
local DAMAGE = 30 -- health taken by every character inside the blast
local BLAST_RADIUS = 6 -- studs around the impact
local FRIENDLY_FIRE = false

local castEvent = Instance.new("RemoteEvent")
castEvent.Name = "CastFireball"
castEvent.Parent = ReplicatedStorage

local lastCast: { [Player]: number } = {}

local function isTeammate(attacker: Player, target: Player?): boolean
	if FRIENDLY_FIRE or not target then
		return false
	end
	return not attacker.Neutral and not target.Neutral and attacker.Team == target.Team
end

local function makeBall(position: Vector3): Part
	local ball = Instance.new("Part")
	ball.Name = "Fireball"
	ball.Shape = Enum.PartType.Ball
	ball.Size = Vector3.new(2, 2, 2)
	ball.Material = Enum.Material.Neon
	ball.Color = Color3.fromRGB(255, 120, 30)
	ball.Anchored = true -- the script moves it, not physics
	ball.CanCollide = false
	ball.CanTouch = false
	ball.CanQuery = false -- rays and blasts never find the fireball itself
	ball.CastShadow = false
	ball.Position = position

	local fire = Instance.new("Fire")
	fire.Size = 5
	fire.Parent = ball
	local light = Instance.new("PointLight")
	light.Color = ball.Color
	light.Range = 12
	light.Brightness = 2
	light.Parent = ball

	ball.Parent = workspace
	return ball
end

local function explode(caster: Player, casterCharacter: Model, position: Vector3)
	-- The explosion is only the look: no push, and it breaks no joints, so it kills no one by itself
	local blast = Instance.new("Explosion")
	blast.Position = position
	blast.BlastRadius = BLAST_RADIUS
	blast.BlastPressure = 0
	blast.DestroyJointRadiusPercent = 0
	blast.Parent = workspace

	local params = OverlapParams.new()
	params.ExcludeInstances = { casterCharacter } -- your own fireball never hurts you
	local alreadyHit: { [Model]: boolean } = {}
	for _, part in workspace:GetPartBoundsInRadius(position, BLAST_RADIUS, params) do
		local model = part:FindFirstAncestorOfClass("Model")
		local humanoid = model and model:FindFirstChildOfClass("Humanoid")
		if model and humanoid and humanoid.Health > 0 and not alreadyHit[model] then
			alreadyHit[model] = true -- one hit per character, however many of its parts are in range
			if not isTeammate(caster, Players:GetPlayerFromCharacter(model)) then
				humanoid:TakeDamage(DAMAGE)
			end
		end
	end
end

local function launch(caster: Player, casterCharacter: Model, root: BasePart, origin: Vector3, direction: Vector3)
	local rayParams = RaycastParams.new()
	rayParams.ExcludeInstances = { casterCharacter }

	-- If the spawn point is behind a wall (the player hugs it), explode on the wall straight away
	local blocked = workspace:Raycast(root.Position, origin - root.Position, rayParams)
	if blocked then
		explode(caster, casterCharacter, blocked.Position)
		return
	end

	local ball = makeBall(origin)
	local position = origin
	local travelled = 0
	local connection: RBXScriptConnection? = nil
	connection = RunService.Heartbeat:Connect(function(deltaTime: number)
		local step = direction * SPEED * deltaTime
		-- Cast along this frame's step. Anything in the way is the hit.
		local result = workspace:Raycast(position, step, rayParams)
		if result then
			if connection then
				connection:Disconnect()
			end
			ball:Destroy()
			explode(caster, casterCharacter, result.Position)
			return
		end
		position += step
		travelled += step.Magnitude
		ball.Position = position
		if travelled >= MAX_RANGE then
			if connection then
				connection:Disconnect()
			end
			ball:Destroy()
		end
	end)
end

castEvent.OnServerEvent:Connect(function(player: Player, aimPoint: unknown)
	-- 1. The only argument is a position. Check its type and refuse NaN, which is never equal to itself.
	if typeof(aimPoint) ~= "Vector3" or aimPoint ~= aimPoint then
		return
	end

	-- 2. Alive, holding the Tool, off cooldown: all decided here
	local character = player.Character
	local humanoid = character and character:FindFirstChildOfClass("Humanoid")
	local root = humanoid and humanoid.RootPart
	if not (character and humanoid and root) or humanoid.Health <= 0 then
		return
	end
	if REQUIRE_TOOL then
		local tool = character:FindFirstChild(TOOL_NAME)
		if not (tool and tool:IsA("Tool")) then
			return
		end
	end
	local now = os.clock()
	if now - (lastCast[player] or 0) < COOLDOWN then
		return
	end

	-- 3. The fireball starts in front of the player's chest, not wherever the client says
	local origin = root.Position + root.CFrame.LookVector * 3 + Vector3.new(0, 1, 0)
	local offset = aimPoint - origin
	if offset.Magnitude < 1 or offset.Magnitude > 100000 then
		return -- too close to aim, or a huge or infinite position
	end
	lastCast[player] = now
	launch(player, character, root, origin, offset.Unit)
end)

Players.PlayerRemoving:Connect(function(player: Player)
	lastCast[player] = nil
end)

RoCode builds it in the place you have open in Roblox Studio, on Windows or macOS with a desktop browser; on a phone the button sends the prompt and the link to your computer. Free to start, with free credits every day. More Roblox Studio scripts

Where to put it

Explorer: the server Script and the Tool
ServerScriptService
  FireballService Script new
StarterPack
  Fireball Tool (RequiresHandle off)
    FireballClient LocalScript

Settings you can change

COOLDOWNIn the script
Seconds between fireballs for one player, checked on the server. Default: 1.5.
DAMAGEIn the script
Health every character inside the blast takes. Players have 100 by default. Default: 30.
SPEEDIn the script
Studs per second the fireball flies. Default: 80.

This Script also needs the Fireball Tool and its LocalScript from Step 2, which send the aim point. The Script makes the CastFireball RemoteEvent itself.

What a cheater can and cannot doA cheater can send any aim point, so they can choose where to throw, the same as a real player. They cannot throw faster than the cooldown, change the damage, speed or range, throw while dead or throw from a different place than their character: what the server checks.

Type-checked with luau-lsp strict against Roblox's API definitions on 14 November 2026. Not playtested in Studio yet: press Play and watch the Output window before you publish.

Prompt for RoCode

Add a fireball Tool to my game: a Tool named Fireball in StarterPack with RequiresHandle off and a LocalScript that sends only the aim point through a RemoteEvent, and one Script in ServerScriptService that checks a 1.5 second cooldown, that the player is alive and holding the Tool, spawns a glowing ball in front of them, moves it at 80 studs per second with a raycast each frame, and on impact shows an Explosion with no pressure and deals 30 damage once to every other character within 6 studs, with no friendly fire.

On this page
  1. Get the script
  2. How it works
  3. 1. Server
  4. 2. Tool
  5. Server checks
  6. 3. Q key
  7. 4. Test
  8. Common errors
  9. With RoCode
  10. Questions
  11. Sources

How a fireball works

A projectile needs two scripts, because only the player's device knows where the mouse is, and only the server can be trusted with damage.

Who does what
StepRuns onWhat happens
1. ClickClient (LocalScript in the Tool)Turns the mouse or tap position into a point in the 3D world and sends it with FireServer.
2. CheckServer (FireballService)Is it a real Vector3? Is the player alive, holding the Tool and off cooldown?
3. FlyServerSpawns the ball and moves it a small step every frame, casting a ray along each step.
4. HitServerThe ray hits a wall or a body: show an Explosion and damage everyone in the blast radius once.

The fireball is an anchored part with collisions off. The script moves it by setting its position, so physics never pushes it around, and the raycast decides the hit. If RemoteEvents are new to you, read how RemoteEvents work first: this guide uses one, from client to server.

Step 1: The server script

  1. Hover over ServerScriptService, click + and insert a Script. Name it FireballService.
  2. Paste the code below. It creates the CastFireball RemoteEvent in ReplicatedStorage when the game starts, so you do not need to make one.
Script in ServerScriptService named FireballService
-- Script in ServerScriptService named FireballService.
-- Checks each cast, then spawns, moves and explodes the fireball. The client only sends an aim point.
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")

local TOOL_NAME = "Fireball" -- the Tool the player must be holding
local REQUIRE_TOOL = true -- false for a key ability with no Tool (Step 4)
local COOLDOWN = 1.5 -- seconds between fireballs for one player
local SPEED = 80 -- studs per second
local MAX_RANGE = 300 -- studs before the fireball fizzles out
local DAMAGE = 30 -- health taken by every character inside the blast
local BLAST_RADIUS = 6 -- studs around the impact
local FRIENDLY_FIRE = false

local castEvent = Instance.new("RemoteEvent")
castEvent.Name = "CastFireball"
castEvent.Parent = ReplicatedStorage

local lastCast: { [Player]: number } = {}

local function isTeammate(attacker: Player, target: Player?): boolean
	if FRIENDLY_FIRE or not target then
		return false
	end
	return not attacker.Neutral and not target.Neutral and attacker.Team == target.Team
end

local function makeBall(position: Vector3): Part
	local ball = Instance.new("Part")
	ball.Name = "Fireball"
	ball.Shape = Enum.PartType.Ball
	ball.Size = Vector3.new(2, 2, 2)
	ball.Material = Enum.Material.Neon
	ball.Color = Color3.fromRGB(255, 120, 30)
	ball.Anchored = true -- the script moves it, not physics
	ball.CanCollide = false
	ball.CanTouch = false
	ball.CanQuery = false -- rays and blasts never find the fireball itself
	ball.CastShadow = false
	ball.Position = position

	local fire = Instance.new("Fire")
	fire.Size = 5
	fire.Parent = ball
	local light = Instance.new("PointLight")
	light.Color = ball.Color
	light.Range = 12
	light.Brightness = 2
	light.Parent = ball

	ball.Parent = workspace
	return ball
end

local function explode(caster: Player, casterCharacter: Model, position: Vector3)
	-- The explosion is only the look: no push, and it breaks no joints, so it kills no one by itself
	local blast = Instance.new("Explosion")
	blast.Position = position
	blast.BlastRadius = BLAST_RADIUS
	blast.BlastPressure = 0
	blast.DestroyJointRadiusPercent = 0
	blast.Parent = workspace

	local params = OverlapParams.new()
	params.ExcludeInstances = { casterCharacter } -- your own fireball never hurts you
	local alreadyHit: { [Model]: boolean } = {}
	for _, part in workspace:GetPartBoundsInRadius(position, BLAST_RADIUS, params) do
		local model = part:FindFirstAncestorOfClass("Model")
		local humanoid = model and model:FindFirstChildOfClass("Humanoid")
		if model and humanoid and humanoid.Health > 0 and not alreadyHit[model] then
			alreadyHit[model] = true -- one hit per character, however many of its parts are in range
			if not isTeammate(caster, Players:GetPlayerFromCharacter(model)) then
				humanoid:TakeDamage(DAMAGE)
			end
		end
	end
end

local function launch(caster: Player, casterCharacter: Model, root: BasePart, origin: Vector3, direction: Vector3)
	local rayParams = RaycastParams.new()
	rayParams.ExcludeInstances = { casterCharacter }

	-- If the spawn point is behind a wall (the player hugs it), explode on the wall straight away
	local blocked = workspace:Raycast(root.Position, origin - root.Position, rayParams)
	if blocked then
		explode(caster, casterCharacter, blocked.Position)
		return
	end

	local ball = makeBall(origin)
	local position = origin
	local travelled = 0
	local connection: RBXScriptConnection? = nil
	connection = RunService.Heartbeat:Connect(function(deltaTime: number)
		local step = direction * SPEED * deltaTime
		-- Cast along this frame's step. Anything in the way is the hit.
		local result = workspace:Raycast(position, step, rayParams)
		if result then
			if connection then
				connection:Disconnect()
			end
			ball:Destroy()
			explode(caster, casterCharacter, result.Position)
			return
		end
		position += step
		travelled += step.Magnitude
		ball.Position = position
		if travelled >= MAX_RANGE then
			if connection then
				connection:Disconnect()
			end
			ball:Destroy()
		end
	end)
end

castEvent.OnServerEvent:Connect(function(player: Player, aimPoint: unknown)
	-- 1. The only argument is a position. Check its type and refuse NaN, which is never equal to itself.
	if typeof(aimPoint) ~= "Vector3" or aimPoint ~= aimPoint then
		return
	end

	-- 2. Alive, holding the Tool, off cooldown: all decided here
	local character = player.Character
	local humanoid = character and character:FindFirstChildOfClass("Humanoid")
	local root = humanoid and humanoid.RootPart
	if not (character and humanoid and root) or humanoid.Health <= 0 then
		return
	end
	if REQUIRE_TOOL then
		local tool = character:FindFirstChild(TOOL_NAME)
		if not (tool and tool:IsA("Tool")) then
			return
		end
	end
	local now = os.clock()
	if now - (lastCast[player] or 0) < COOLDOWN then
		return
	end

	-- 3. The fireball starts in front of the player's chest, not wherever the client says
	local origin = root.Position + root.CFrame.LookVector * 3 + Vector3.new(0, 1, 0)
	local offset = aimPoint - origin
	if offset.Magnitude < 1 or offset.Magnitude > 100000 then
		return -- too close to aim, or a huge or infinite position
	end
	lastCast[player] = now
	launch(player, character, root, origin, offset.Unit)
end)

Players.PlayerRemoving:Connect(function(player: Player)
	lastCast[player] = nil
end)

The fireball moves SPEED * deltaTime studs each frame. deltaTime is the time since the last frame, so the ball flies at the same speed on a busy server that runs fewer frames. At 80 studs per second and 60 frames a second each step is about 1.3 studs, and the ray covers that whole step, so the fireball cannot skip through a thin wall between two frames.

The ray excludes the caster's character, so the fireball does not hit the player who threw it as it leaves their hand. The blast also excludes them, so standing next to your own impact is safe. Remove the caster from params.ExcludeInstances in explode if you want self-damage, like a rocket jump.

Step 2: The Tool and its LocalScript

  1. Insert a Tool into StarterPack and name it Fireball. It must match TOOL_NAME.
  2. Select the Tool and untick RequiresHandle in the Properties window. This Tool has no part to hold; the player just raises an empty hand. (If you add a part named Handle for a staff or a wand, leave it ticked.)
  3. Insert a LocalScript inside the Tool named FireballClient and paste the code below.
LocalScript in the Fireball Tool in StarterPack named FireballClient
-- LocalScript inside the Fireball Tool, named FireballClient.
-- Works out where the player is aiming and sends that point to the server.
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")

local tool = script.Parent :: Tool
local castEvent = ReplicatedStorage:WaitForChild("CastFireball") :: RemoteEvent

local COOLDOWN = 1.5 -- the same value as in FireballService
local AIM_DISTANCE = 1000

local player = Players.LocalPlayer
local lastTouch: Vector2? = nil

-- Phones have no mouse, so remember where the last tap on the 3D world was
UserInputService.TouchStarted:Connect(function(touch: InputObject, processedByUI: boolean)
	if not processedByUI then
		lastTouch = Vector2.new(touch.Position.X, touch.Position.Y)
	end
end)

local function getAimPoint(): Vector3
	local camera = workspace.CurrentCamera
	local ray: Ray
	local input = UserInputService.PreferredInput
	if input == Enum.PreferredInput.Touch and lastTouch then
		ray = camera:ScreenPointToRay(lastTouch.X, lastTouch.Y)
	elseif input == Enum.PreferredInput.KeyboardAndMouse then
		local mouse = UserInputService:GetMouseLocation()
		ray = camera:ViewportPointToRay(mouse.X, mouse.Y)
	else -- a gamepad, or a phone before its first tap: the centre of the screen
		local size = camera.ViewportSize
		ray = camera:ViewportPointToRay(size.X / 2, size.Y / 2)
	end
	local params = RaycastParams.new()
	params.ExcludeInstances = { player.Character :: Model }
	local result = workspace:Raycast(ray.Origin, ray.Direction * AIM_DISTANCE, params)
	return if result then result.Position else ray.Origin + ray.Direction * AIM_DISTANCE
end

tool.Activated:Connect(function()
	if UserInputService.PreferredInput == Enum.PreferredInput.Touch then
		task.wait() -- one frame, so TouchStarted has recorded this tap
	end
	castEvent:FireServer(getAimPoint())
	-- Grey the Tool out locally while it cools down. The server still checks the real cooldown.
	tool.Enabled = false
	task.delay(COOLDOWN, function()
		tool.Enabled = true
	end)
end)

ViewportPointToRay turns a point on the screen into a ray that starts at the camera and points into the world through that pixel. The LocalScript casts that ray to find what is under the mouse, a wall, the floor or another player, and sends the hit position. The server then throws the fireball from the player towards that point.

Setting tool.Enabled = false stops Activated firing on this device until the cooldown ends, so normal players do not waste clicks. It is a comfort feature only. A cheater can skip it, which is why the server keeps its own lastCast time.

What the server checks, and why

Anything a LocalScript sends can be faked. A cheater can call FireServer with any value, as often as they like. Each check in FireballService answers one of those tricks.

The checks in FireballService
CheckStops
typeof(aimPoint) ~= "Vector3" and the NaN testSending a string, a table or a broken number that would make the maths error.
Alive, with a Humanoid and a rootCasting while dead or before the character loads.
Holding the Tool (when REQUIRE_TOOL is true)Casting with a weapon you do not have equipped.
lastCast cooldownSpamming the RemoteEvent to throw 60 fireballs a second.
Origin from the server's own root positionThrowing from the other side of the map.
Range limit of 100000 studs on the aim pointAn infinite position that would break the direction maths.

Speed, range and damage are never sent at all, so there is nothing to fake. The RemoteEvents guide covers this rule for every kind of remote.

Step 3 (optional): Press Q to cast

Battlegrounds and anime games use keys instead of Tools. To cast with Q (or Y on a gamepad, or an on-screen button on a phone) without holding anything, set REQUIRE_TOOL = false in FireballService, delete the Tool, and add this LocalScript instead.

  1. Hover over StarterPlayer, then StarterPlayerScripts, and insert a LocalScript named FireballKey.
  2. Paste the code below.
LocalScript in StarterPlayerScripts named FireballKey
-- LocalScript in StarterPlayerScripts named FireballKey.
-- Q on a keyboard, Y on a gamepad, or an on-screen button on a phone casts a fireball.
local ContextActionService = game:GetService("ContextActionService")
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")

local castEvent = ReplicatedStorage:WaitForChild("CastFireball") :: RemoteEvent

local COOLDOWN = 1.5 -- the same value as in FireballService
local AIM_DISTANCE = 1000

local player = Players.LocalPlayer
local lastCast = 0

local function getAimPoint(): Vector3
	local camera = workspace.CurrentCamera
	local point: Vector2
	if UserInputService.PreferredInput == Enum.PreferredInput.KeyboardAndMouse then
		point = UserInputService:GetMouseLocation()
	else -- gamepad and touch aim at the centre of the screen
		point = camera.ViewportSize / 2
	end
	local ray = camera:ViewportPointToRay(point.X, point.Y)
	local params = RaycastParams.new()
	local character = player.Character
	params.ExcludeInstances = if character then { character } else {}
	local result = workspace:Raycast(ray.Origin, ray.Direction * AIM_DISTANCE, params)
	return if result then result.Position else ray.Origin + ray.Direction * AIM_DISTANCE
end

local function onCast(_actionName: string, state: Enum.UserInputState, _input: InputObject): Enum.ContextActionResult
	if state ~= Enum.UserInputState.Begin then
		return Enum.ContextActionResult.Pass
	end
	local now = os.clock()
	if now - lastCast >= COOLDOWN then
		lastCast = now
		castEvent:FireServer(getAimPoint())
	end
	return Enum.ContextActionResult.Sink
end

-- true adds a touch button on phones and tablets
ContextActionService:BindAction("CastFireball", onCast, true, Enum.KeyCode.Q, Enum.KeyCode.ButtonY)
ContextActionService:SetTitle("CastFireball", "Fire")

The server code does not change apart from REQUIRE_TOOL. Every other check still runs, so the Q key is exactly as safe as the Tool. To give each player a cast animation, play it from this LocalScript when you call FireServer: the animation guide shows how.

Step 4: Test it

  1. Put a dummy in front of the spawn (Avatar tab, Rig Builder) and press Play.
  2. Equip the Fireball (press 1) and click on the dummy. A glowing ball flies to it, explodes and the dummy loses 30 health.
  3. Click on a wall: the fireball explodes on the wall. Click at the sky: it flies 300 studs and disappears.
  4. Click quickly: the Tool greys out and nothing is thrown until 1.5 seconds have passed.
  5. Stand against a wall facing it and click: the explosion appears on the wall, not behind it.
  6. Test two players from the Test tab (Clients and Servers, 2 players, Start) to check that both see the same fireball and that teammates take no damage.

Common errors and fixes

If nothing happens, open the Output window first: a red line names the script and the line.

Clicking does nothing

Check that RequiresHandle is unticked on the Tool (or that it has a part named Handle), that the Tool is named exactly Fireball, and that FireballService is a Script in ServerScriptService. Without the server script, the LocalScript waits forever for CastFireball and the Output shows Infinite yield possible.

The explosion kills everyone at once

The DestroyJointRadiusPercent line is missing. Explosions break the joints of characters in range by default, which kills them. Set it to 0 and let the script deal damage.

The fireball hits me as it leaves my hand

The caster must be in rayParams.ExcludeInstances. Check you pass the character Model, not the Player.

It explodes straight away in open space

The ray is hitting something invisible, such as a transparent part with CanQuery ticked. Untick CanQuery on invisible walls and trigger parts that projectiles should pass through.

FireServer errors on the server

FireServer only works in a LocalScript. Server scripts use FireClient or FireAllClients: see FireServer can only be called from the client.

Build it with RoCode

If you would rather not set this up by hand, RoCode can build it in the place you have open. RoCode is an independent AI agent for Roblox Studio, not made by Roblox: you describe the change in a web chat, and its Studio plugin creates the parts and scripts in your Explorer, so there is no code to paste.

You type

Add a fireball ability on the Q key: the server checks a 1.5 second cooldown, throws a glowing ball where I aim, and the blast deals 30 damage to everyone within 6 studs except my team.

RoCode does
  • Can read your place first to see what weapons and teams already exist, then writes the client and server scripts
  • Writes the scripts with Create Script and is told to compile-check each one with Check Script
  • Sets an undo point before and after each batch of changes, so Ctrl+Z steps back one batch at a time

A whole battlegrounds game is a few prompts, one system at a time: how building one system per prompt works. How RoCode connects to Studio.

Questions

How do I make a fireball in Roblox Studio?

Use a Tool whose LocalScript sends the aim point through a RemoteEvent, and a server Script that spawns an anchored ball, moves it each Heartbeat with a raycast, and deals damage around the impact. Steps 1 and 2 have both scripts.

How do I make a projectile in Roblox?

Create a part on the server, move it a small step every frame, and cast a ray along each step to find the hit. This works for fireballs, arrows, snowballs and rockets. Change the look in makeBall and the numbers at the top.

Should projectiles be made on the client or the server?

The server should decide the hit and the damage. Small games can move the projectile on the server too, as this guide does. Very busy games draw the projectile on each client for smoothness but still check hits on the server.

How do I add a cooldown to an ability?

Store the time of the last cast per player on the server with os.clock() and refuse a new cast until enough time has passed. The client can grey out the Tool, but only the server check counts.

Why use raycasts instead of Touched for projectiles?

A fast part can move past a thin wall between two physics steps without touching it. A ray covers the whole distance moved each frame, so it cannot skip anything.

How do I make the fireball explode without killing people instantly?

Set Explosion.BlastPressure to 0 and Explosion.DestroyJointRadiusPercent to 0. The explosion is then just the look, and your script decides the damage.

Sources and further reading

How the code was checked: every script on this page passes Luau's strict type checker against Roblox's API definitions (luau-lsp, 14 November 2026). A type check catches misspelt APIs and wrong types, not game logic, so playtest in Studio before you publish.

Try RoCode on your own place.

Free every day, no card required. Install the plugin, describe the feature, and review what lands in Studio.