Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I have this GUI put items directly into the player's backpack?

Asked by 10 years ago

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

Answer this question