XSF / Guides / Make an FPS game in Roblox
How to make an FPS game in Roblox Studio
The guns are the hard part of a Roblox shooter, so start with a gun system that already works and spend your time on the game. This guide uses XSF (free, 59 guns) and ends with a team deathmatch with a leaderboard and timed rounds.
Steps
- Install XSF. Follow how to add guns to Roblox Studio. About three minutes. If you don't have a map, drop in XSF_TestMap from the download.
- Pick the loadout. Set
Loadoutin GameConfig, for example{ "M4A1", "MP5", "G17", "KaBar", "M67" }, or use the dashboard. - Add two teams. Insert two Teams under the Teams service, name them Red and Blue, give them colours and turn AutoAssignable on. Add a SpawnLocation for each team with the matching TeamColor and Neutral off. Turn friendly fire off with
Damage = { FriendlyFire = false }. - Count kills. Add a leaderboard with a server Script (below). XSF tells you who got the kill.
- Add rounds. A loop that resets scores, waits and announces the winner (below).
- Pick the feel. Camera style (bodycam or standard), movement, downed and revive, crosshair and more are one line each, or one click on the dashboard.
- Publish. File > Publish to Roblox, and keep Allow HTTP Requests on in the published game.
Kill leaderboard
Put this in a Script in ServerScriptService:
local Players = game:GetService("Players")
local XSF = require(game.ServerScriptService.XSF.Server)
Players.PlayerAdded:Connect(function(player)
local stats = Instance.new("Folder")
stats.Name = "leaderstats"
local kills = Instance.new("IntValue")
kills.Name = "Kills"
kills.Parent = stats
stats.Parent = player
end)
XSF.Killed:Connect(function(victim, killer)
if killer and killer:FindFirstChild("leaderstats") then
killer.leaderstats.Kills.Value += 1
end
end)
Timed rounds
A second Script. Swap the print for your own UI when you're ready.
local Players = game:GetService("Players")
local ROUND = 300 -- seconds
while true do
for _, p in Players:GetPlayers() do
if p:FindFirstChild("leaderstats") then p.leaderstats.Kills.Value = 0 end
p:LoadCharacter()
end
task.wait(ROUND)
local best, top = nil, -1
for _, p in Players:GetPlayers() do
local k = p:FindFirstChild("leaderstats") and p.leaderstats.Kills.Value or 0
if k > top then best, top = p, k end
end
print(best and (best.Name .. " wins with " .. top .. " kills") or "No winner")
task.wait(10)
end
Ideas to build on
The docs have recipes for each of these: a class picker, gun game (a new gun every kill), battle royale loot with pickups and ammo boxes, a kill feed, a gun shop, and unlocks or skins tied to levels. For NPC enemies, give any Humanoid an XSF_Weapon attribute.
Questions
How do you make an FPS game in Roblox?
Install a gun system such as XSF for the guns, add two Teams with spawn locations, then add a kill leaderboard and a round loop. This page has the scripts.
Can I make an FPS game in Roblox without scripting?
Mostly. XSF and its dashboard cover guns, movement, camera and damage. Teams and spawns are done in Studio without code. Rounds and leaderboards need the short scripts on this page.
Is it free?
Yes. XSF is free, including in games that earn Robux.
Does it work on mobile?
Yes. Phones get touch controls players can move and resize, and consoles get aim assist and a weapon wheel.
XSF