You could have a script similar to leaderstats, but for weapons instead. Use Data Persistence or Data store to save weapons.
When they buy a weapon, make sure to set the player's weapon of selection to true in the weaponstats.
If they buy a rocket, then something like this would be needed:
game.Players.LocalPlayer.weaponstats.Rocket.Value = true
In the ServerScriptService:
01 | game.Players.PlayerAdded:connect( function (player) |
02 | local weps = Instance.new( "ObjectValue" ) |
03 | weps.Name = "weaponstats" |
05 | local tool 1 = Instance.new( "BoolValue" ) |
09 | local tool 2 = Instance.new( "BoolValue" ) |
13 | local tool 3 = Instance.new( "BoolValue" ) |
In the StarterGui as a LocalScript:
02 | local plr = game.Players.LocalPlayer |
03 | local stat = plr.weaponstats |
05 | if stat.Rocket.Value then |
06 | rocket = game.ReplicatedStorage [ "Rocket" ] :Clone() |
07 | rocket.Parent = plr.Backpack |
10 | if stat.Bomb.Value then |
11 | bomb = game.ReplicatedStorage [ "Bomb" ] :Clone() |
12 | bomb.Parent = plr.Backpack |
15 | if stat.Sword.Value then |
16 | sword = game.ReplicatedStorage [ "Sword" ] :Clone() |
17 | sword.Parent = plr.Backpack |
Make sure your weapons are stored in the ReplicatedStorage, for LocalScripts to be able to access.