XSF / Guides / Add guns to Roblox Studio

How to add guns to Roblox Studio

You don't need to script a gun from scratch. Install a gun system once and every gun after that is one line. This guide uses XSF, which is free and comes with 59 guns. It takes about three minutes.

Install the gun system

  1. Download XSF. Make a free account on xsfshooter.com and download the model. Your license key is already inside it. XSF is only published there, never in the Toolbox.
  2. Drag it into Studio. Open your place in Roblox Studio and drag the downloaded file into the viewport. You get a folder named XSF_Release.
  3. Move the three folders. Inside XSF_Release, drag the XSF folder under ReplicatedStorage into ReplicatedStorage, the one under ServerScriptService into ServerScriptService, and XSF_Boot into StarterPlayer > StarterPlayerScripts.
  4. Turn on HTTP requests. Home > Game Settings > Security, turn on Allow HTTP Requests and save. XSF uses it to check your license.
  5. Press Play. You spawn holding the default guns. Left click fires, right click aims, R reloads. If nothing happens, read the orange [XSF] line in the Output window, it says exactly what is wrong.

There's also a one minute video of the whole install on YouTube.

Choose which guns players get

Open ReplicatedStorage.XSF.GameConfig and change Loadout. The first five go on the number keys. Names are the folder names in XSF.Weapons, the full list is on the weapons page.

Loadout = { "M4A1", "MP5", "G17", "KaBar", "M67" },

Prefer not to touch code? The website dashboard has the same setting, plus every gun's damage, fire rate, ammo and recoil.

Give guns from a script

For teams, classes, shops or rewards, give guns from a server Script:

local XSF = require(game.ServerScriptService.XSF.Server)

-- swap the whole loadout
XSF.SetLoadout(player, { "HK416", "USP", "M67" })

-- or add one gun
XSF.Give(player, "AWM")

If scripts hand out every gun, add GiveLoadout = false to GameConfig so players don't also spawn with the default loadout.

Make a gun shop pad

A part that gives a shotgun once per life when touched:

local XSF = require(game.ServerScriptService.XSF.Server)
local given = {}
script.Parent.Touched:Connect(function(hit)
	local player = game.Players:GetPlayerFromCharacter(hit.Parent)
	if player and not given[player] then
		given[player] = true
		XSF.Give(player, "M870")
		player.CharacterAdded:Once(function() given[player] = nil end)
	end
end)

Spawn guns and ammo on the map

Pickups are how battle royale loot works. Players press F to grab them and X to drop what they hold.

XSF.SpawnPickup("AK47", spot.CFrame, { mag = 30, reserve = 60, atts = { Sight = "Acog" } })
XSF.SpawnPickup("Ammo", crate.CFrame, { Mags = 3, Uses = 4 })

Give an NPC a gun

Set an attribute named XSF_Weapon on any Humanoid model to a weapon name, for example "AK47". It holds the gun properly, takes damage by body part and ragdolls.

Next steps

How to make an FPS game in Roblox turns this into a team deathmatch. The docs cover every option.

Questions

How do I add a gun to Roblox Studio?

The quickest way is a gun system like XSF: install it once, then every gun is one line in the Loadout list or one call to XSF.Give(player, "AK47") from a script.

Are free model guns safe to use?

Many Toolbox guns trust the client, which exploiters abuse, and some contain hidden scripts. Use a system that checks hits on the server and comes from an official source.

Why do I spawn without guns?

The names in Loadout must match the weapon folder names in ReplicatedStorage.XSF.Weapons exactly, capitals included. Also check that Allow HTTP Requests is on.

Can I make my own gun?

Yes. Each weapon is a folder with a model and a short Config that only lists what is different from the defaults. ACS guns can be imported with the included importer.

Do I need to know Lua?

No. The website dashboard handles loadouts and gun stats. The code on this page is only for things like shops and pickups.