Hello there!
I’ve created a simple inventory for a fangame for a game I’ve recently started playing again called “World of Trollged”. You can store items in the inventory by simply equipping an item you want to store in and clicking on one of the available slots.
The issue however is that after storing the item in, you cannot get it out for whatever reason. (Local script)
--//General
local Frame = script.Parent
local Slots = Frame:WaitForChild("Slots")
--//Player
local Player = game.Players.LocalPlayer
--//Func
while task.wait() do
for _, Slot in pairs(Slots:GetChildren()) do
if Slot:IsA("TextButton") then
local IsSelected = false
Slot.Activated:Connect(function()
if Player.Character:FindFirstChildWhichIsA("Tool") then
local SelectedTool = Player.Character:FindFirstChildWhichIsA("Tool")
if IsSelected == false then
IsSelected = true
Slot.Text = SelectedTool.Name
SelectedTool.Parent = Player
elseif IsSelected == true then
IsSelected = false
Slot.Text = "Nothing"
SelectedTool.Parent = Player.Backpack
end
end
end)
end
end
end