What do you want to achieve? Keep it simple and clear!
So for example, when a player picks up, equips, or something to a tool, and is added into their backpack. That tool will be assigned to say, the sixth slot, even if the player had no tools.
So basically,
player initially had no tools,
player obtained a tool,
that tool needs to go to the sixth slot
the tool is put(parented? slotted?) into the sixth slot
What is the issue? Include screenshots / videos if possible!
Currently I have this:
which is part of a bigger script. But the main problem is probably just here.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I like to use ChatGPT since it can help with most small problems with a snap of the fingers, but it’s been going around in circles when I tried to tell them that the backpack didn’t seem to have hotkeys inside.
I meant that, since most YT tutorials involve cloning the buttons and arraying them, I won’t be able to learn from there.
Instead I want to put items in slots that already exist, except I’m clueless on how to connect that backpack with this GUI while putting the correct tools in the correct slots.
Or just using the default backpack to do it, which cooli says is impossible to do.
when the player presses on one of the slots, send a remote event to the server telling the server which icon they pressed (using a string), then on the server go to the slot that the client pressed and check if they have a tool there. if there is a tool there, check for any tools that the player has equipped and put it in the slot it was in originally. then take the pressed slot tool and reparent it to the player’s character. i hope that helps
I don’t really understand this part, but let me try…
So first the player clicks a button or presses the corresponding key.
This tells its local script to remember the name of the tool as a string and fire and event to the server.
The server check’s the player’s backpack or character model and looks for the tool’s name.
With these working together, the “default hotkey” each tool is in is no longer relevant as it just looks for the existence of the tool.
yeah it took me 9 minutes to understand/not understand that
when you scroll to the very bottom of an instance, there is something called attributes. they are like values, but newer. you can configure attributes with scripts by
Part:SetAttribute("Attribute Name", "Value Data")
-- sets the name of the attribute in the first argument to the data set in the second argument
Part:GetAttribute("Attribute Name")
-- returns whatever value is set there, can be nil. in this case it would return "Value Data"
So I gave it a bit of thought. I still don’t understand what attirbutes are(I did notice this thing in them objects), but I have some other ideas.
I’ve been using an “inventory”, not hotbar, to show the player which items are being equipped, and their supposed hotkey.
name : amount – hotkey
When an item is equipped, an int value is created and parented to a player’s folder(folder created when player joins) called “EquipedBackpack”
the Name is the tool’s name, the value is the hotkey it’s supposed to go in.
Theoretically, what I would need a local script to do, is to look for this value everytime a new child is added/removed, the local script first find the tool name inside the player’s backpack, then get its image and put it in the corresponding image button.
When the player clicks the button, or presses the correct key, the script will then fire a remote event to the server with the name of the tool.
A server script will check the string fired from the button/event and find the matching tool either in the player’s backpack, or the player’s model. If it finds it in the model, remove the tool and place it in the backpack, and vise versa.
If it works, the defeault slot the tool was in will become irrelevant as the script only look for the existence of the tools.
Is this a plausable approach, or is it back to the drawing board(plz no).