The purpose of the GUI is to allow the player to select a weapon they want and they spawn with that weapon, but I can't get it to work right.
The weapons are in the game's lighting.
How do I tweak it so the GUI gives the player their weapon whenever they spawn?
local function equip_tools(player)
local weps = game.Lighting["Weapons"]
local inventory = player:findFirstChild("wep_storage")
if inventory then
local purchased_wep = weps[inventory.purchased.Value]
local gp_wep = weps:findFirstChild(inventory.game_pass.Value) or nil
if gp_wep ~= nil then
gp_wep:Clone().Parent = player.Backpack
end
purchased_wep:Clone().Parent = player.Backpack
else
if map["Tools"]:findFirstChild("LinkedSword") then
map["Tools"]["LinkedSword"]:Clone().Parent = player.Backpack
else
map["Tools"]["Sword"]:Clone().Parent = player.Backpack
end
end
end