Cannot get item out off inventory after storing it in

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
1 Like

bump 1#
filler fillr sorry roblox

remove the while loop because youre creating a bunch of activated events and it should work

nvm I managed to fix it on my own somehow

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.