Like all the function calls, but not the functions themselves
No that was just my example, essentially you would only call them when needed.
I have this code format which was used to add items before. Could this be left intact or does anything have to change?
local Info = {
Item1 = "Bucket",
Num1 = 1,
}
script.Parent.Triggered:Connect(function(player)
script.Parent.Enabled = false
local PlayerID = player.UserId
local Location = script
game.ReplicatedStorage.Inventory.AddItemBindable:Fire(player, {
Location = Location,
PlayerID = PlayerID,
Num1 = Info.Num1,
Item1 = Info.Item1
})
end)
Well, how you do it seems fine but you could definitely improve the naming structure of the data: âItemâ instead of âItem1â and âAmountâ instead of âNum1â. Also seems like âLocationâ is just the slot so rename it to smth like âSlotIdâ
I used Location so that the Inventory handler knows where the remote event was fired from, so then it can fire events inside that script which ill do things like delete the part, or return a certain amount if the inventory is overflowing.
Oh I c, I donât suppose you have to change any of that since its tied to your game logic
Okay thanks. I need to figure out what to do now for finding the correct player inventory. Should I check for the UserId still or the name?
I actually set the index as the player instance since instances are pretty much unique but ye you can opt for UserId but donât do name
Should this conversation be moved to DMs so this thread doesnât continue to expand?
Absolutely, tho itâd be better if it was in discord rather than here in the forum
Okay that would work out. Send me your username
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.