#Nem's Backpack Module (BackpackManager)

1 messages · Page 2 of 1

pastel stream
#

Use parameters for the return in :Wait

visual shore
#

return is needed because params func is only used to assign a variable name to the params

pastel stream
#

I got it working perfectly without any kind of return parameter

visual shore
#

show me

pastel stream
#

Well here's Signal+'s updated Signal type:

export type Signal<Parameters = (...any) -> ()> = {
    Connect: typeof(
        -- Connects the given function.
        function(signal: Signal<Parameters>, callback: Parameters): Connection end
    ),
    Once: typeof(
        -- Connects the given function, but disconnects after first fire.
        function(signal: Signal<Parameters>, callback: Parameters): Connection end
    ),
    Wait: typeof(
        -- Yields the current thread until the next fire.
        function(signal: Signal<Parameters>): Parameters end
    ),
    
    Fire: typeof(
        -- Fires all callbacks and resumes all waiting threads.
        function(signal: Signal<Parameters>, ...: Parameters) end
    ),
    
    DisconnectAll: typeof(
        -- Disconnects all connections.
        function(signal: Signal<Parameters>) end
    ),
    Destroy: typeof(
        -- Disconnects all connections, and makes the signal unusable.
        function(signal: Signal<Parameters>) end
    ),
}

It does contain a few typeof, which is just a little trick to get comments/documentation for the functions.

#

Oh wait nvm

#

It's right that for Wait and Fire you can't just put in the function, and you have to use a seperate parameter.

#

That's frustrating

#

I really want there to be a better solution.

visual shore
#

I hope in the new type solver there will be some sort of things like that, the actual is really limited for example for this, Idk how their signals are internally type annotated but we'll see how it goes 👍

pastel stream
visual shore
violet comet
#

OP

#

FIRE

worn mirage
#

how do i show tool tips

violet comet
worn mirage
#

doesnt work

violet comet
#

does the tool have a tooltip??

#

like in the properties

worn mirage
#

oh how do i do that

#

oh wait

#

i thought tooltip meant it just showed the name

bronze arrow
#

well its a "tool tip"

violet comet
worn mirage
#

im so stupid sorry guys

worn mirage
#

how do i destroy a tool without it breaking the module

woeful rose
worn mirage
#

nvm im pretty sure i know why

woeful rose
#

is it something on your end?

worn mirage
#

yea i started the backpack in a script in the tool i was destroying

#

im so smart 💔

woeful rose
#

I was considering adding a warning if you start the backpack in a script that is not in playerscripts or replicated first

pastel stream
#

When DevForum post? This could do well.

worn mirage
#

devforumn full of haters

pastel stream
#

You can get a few helpful replies though.

woeful rose
# pastel stream When DevForum post? This could do well.

I was planning some time in the summer because the thing is with a devforum post is people might have issues sortly after a resource has been published or even discover some bugs and I don't want to be working on this while I'm busy with school work

lucid charm
#

this is amazing

fallow ivy
#

this is really really awesome

#

one suggestion is auto expanding tool tip box, which supports new lines. would be cool!

woeful rose
#

new lines arent really supported for tooltips

worn mirage
#

you can just do automaticsize tho right?

unique moss
#

"Tool is not in locaplayer's control"

#

what does this mean?

woeful rose
#

An example of this is if you try calling BackpackManager:Equip() on a tool that is in the workspace

#

The backpack cannot act on these tools because it would cause replication issues.

rugged bobcat
#

whats a tooltip gng and how do I use it 🙏

worn mirage
inner moth
#

What was updated on the March 29 update?

woeful rose
#

It was last updated March 30th

inner moth
woeful rose
#

That's probably localized for your timezone

inner moth
#

Does it have stackable tools in the same slot

woeful rose
#

#1311159199148933150 message

I've mentioned how you could do it in the past.

inner moth
#

how can I disable the back pack icon, and have no way for the user to open the overflow backpack ?

#

so only the hotbar is seen,

woeful rose
#

Next update I was planning to add a function to disable the backpack icon

inner moth
#

also does drag and drop a tool into the workspace work? when I drag it , the slot icon moves , but then it goes back into the slot,.. the tool has drop enabled

woeful rose
#

but still allow the inventory to be opened

woeful rose
#

I believe I had an example from a few months ago

inner moth
#

ok..

#

also why do you recommend putting it in RS , instead of StarterGui?

woeful rose
#

because scripts may potentially reset in startergui

#

which any type of reset may break the module

inner moth
#

how are your requiring it, and getting it into StarterGui... I am using this but then ur code errors out

#
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer

-- Get the BackpackGui (ScreenGui) from ReplicatedStorage
local backpackScreenGui = ReplicatedStorage:WaitForChild("BackpackGui")

-- Find the BackpackManager ModuleScript inside the BackpackGui
local backpackManagerModule = backpackScreenGui:WaitForChild("BackpackManager")

-- Require the BackpackManager module
local backpackSystem = require(backpackManagerModule)

-- Based on the user's example context (BackpackScript.StartBackpack()),
-- attempt to call a StartBackpack function if the module provides one.
if backpackSystem and type(backpackSystem.StartBackpack) == "function" then
    backpackSystem.StartBackpack()
    print("InitializeBackpack: Backpack system started via StartBackpack().")
else
    print("InitializeBackpack: BackpackManager module required, but StartBackpack() function not found or is not a function.")
end

woeful rose
#

Make a script in StarterPlayerScripts then require the backpack and call .StartBackpack()

inner moth
#
37.221  Stack End  -  Studio
  11:12:37.222  Infinite yield possible on 'Players.Lord_BradyRocks.PlayerGui:WaitForChild("BackpackGui")'  -  Studio
  11:12:37.222  Stack Begin  -  Studio
  11:12:37.222  Script 'ReplicatedStorage.BackpackGui.BackpackManager', Line 47  -  Studio - BackpackManager:47
  11:12:37.222  Stack End  -  Studio
woeful rose
#

The backpackmanager gui isnt in playergui

inner moth
#

that is your code

woeful rose
#

Where is the BackpackGui screengui

#

because that is supposed to be in startergui

#

but the actual localscript that calls startbackpack is supposed to be in StarterPlayerScripts

#

And also if your character doesn't load then you may get that warning

inner moth
woeful rose
# inner moth

that is supposed to be in startergui not in replicatedstorage

inner moth
#

you said put it in R S....

woeful rose
#

I said you can put the module there

#

but not the actual screengui

#

ill add clarifications

inner moth
#

oh

#

DOH

#

Maybe an example place that is editable would cut down on my silly config questions... just bare bones ..

woeful rose
#

Which is uncopylocked

#

It’s posted at the top of this resource

inner moth
#

ah.. way down below the api...

#

thanks again, I am going to play around with it more

inner moth
#

... drag and drop would be sweet... 🙂

woeful rose
#

Right now I’m busy with finals so I don’t have too much time

inner moth
#

ah ok.. focus on school

rotund saddle
#

I get this error when an item is repeatedly being dropped and picked up quickly

woeful rose
rotund saddle
#

:D

#

Its just when you forcibly try to break something really lol

woeful rose
#

I wonder what else you can break

rotund saddle
#

Not really sure what I did

woeful rose
#

oh I see

rotund saddle
#

for some reason this can show even after you close the inventory

#

For only about a second tho

#

When you close inv and then hover to item

woeful rose
#

I think? lol

#

Most of those bugs can be easily fixed but I hope non of them caused the module to fully break or become unusable

rotund saddle
#

Something is really messed up for me rn I think

#

But idk what it is

#

Will have to record ig

#

Cuz no errors but its acting weird

woeful rose
#

Ye record it

rotund saddle
#

All I am doing is clicking (NOT HOLDING CTRL)

#

And idk why its acting like that

#

Some of them work fine but others are being moved and snapped around weird

woeful rose
rotund saddle
#

I am just clicking idk

#

And its consistent cuz I can't recreate it with the 2nd slot

woeful rose
#

Are you able to recreate it in-game at all

rotund saddle
#

Is your demo game up to date?

#

Or should I just upload to mine

woeful rose
rotund saddle
#

Alr then I will try it there

#

How am I switching the spots of 2 slots?

#

Is that a feature?

woeful rose
#

Swapping?

rotund saddle
#

yes

woeful rose
#

yes that is a feature

rotund saddle
#

Hows it work

woeful rose
#

You take one slot and drag and drop it over another slot and they will swap places

rotund saddle
#

Great I recorded bug and it wasn't even recording roblox

woeful rose
#

yummy bugs

rotund saddle
#

Can't seem to recreate the swapping issue I was talking about

#

But I think its the same related thing

#

And I think its due to what I am doing here

#

Dropping the item while dragging it and such

#

I am just clicking in this too btw

#

Aye got it now

woeful rose
#

Alrighty if you can post more videos of any more bugs you find I’ll fix them when I have the time

rotund saddle
#

Same as other just more lol

woeful rose
#

But I think most of those bugs are caused by the animate feature

rotund saddle
#

I mean their changing spots when they shouldn't be so idk

#

Actually I think I see wym

woeful rose
#

Ye so there’s a small delay with executing code in some cases when the animate feature is on

#

So when swapping tools, moving them or anything when the animation is finished I usually check if the tool still exists

rotund saddle
#

Should be able to connect to ToolDropped and end the dragging ?

woeful rose
#

No so if the tool is deleted from the tool slot while dragging the “slot” just gets deleted

#

But it’s not the actual slot it’s just a clone of it

#

The real one is unaffected and is just invisible

rotund saddle
#

Ah

woeful rose
#

Though thankfully most of those bugs do not break the entire module and are just animation based bugs STEAMHAPPY

rotund saddle
#

Epic

#

Yeah couldn't get anymore issues

woeful rose
rotund saddle
#

Its same thing in the demo game tho?

woeful rose
#

It is?

rotund saddle
#

Seems like it?

woeful rose
#

You replicated it by clicking once right?

rotund saddle
#

And without holding ctrl

#

Looks the same as that Studio one

woeful rose
#

Okay I’ll investigate when I have time

rotund saddle
#

There does seem to be a scaling issue with the inventory

#

On small devices it can be pretty bleh

#

like this

#

It looks like this on my phone but not as bad lol

bronze arrow
rotund saddle
#

pears

#

pairs and ipairs are not needed anymore

#

But doesn't make difference if you have them

bronze arrow
bronze arrow
#

since it stops at nil and some other behavior

#

but ye GI ftw

woeful rose
woeful rose
#

And you could always make it a tad bit smaller on smaller devices

pastel stream
#

Generalized iteration is faster.

pastel stream
#

These are my benchmark results:

#
local array = {1, 2, 3, 4, 5, 6, 7, 8, 9}

return {
    Runs = 10000,
    
    Functions = {
        ["ipairs"] = function()
            for index, value in ipairs(array) do
                
            end
        end,
        ["pairs"] = function()
            for index, value in pairs(array) do
                
            end
        end,
        ["next"] = function()
            for value in next, array do
                
            end
        end,
        ["Numeric"] = function()
            for index = 1, #array, 1 do
                local value = array[index]
            end
        end,
        ["Custom numeric (while)"] = function()
            local length = #array
            local index = 1
            while true do
                local value = array[index]
                
                if index == length then break end
                index += 1
            end
        end,
        ["Generalized"] = function()
            for index, value in array do
                
            end
        end,
    },
}
#

Generalized is the most clean and the 2nd fastest. If you really want optimization, then next is slightly faster.

rotund saddle
#

Does this not work?

fallow ivy
rotund saddle
#

Anyways use whatever you want

pastel stream
pastel stream
#

It would only make it less reliable

#

I should only measure the loop itself.

#

Not any logic inside

pastel stream
#

ipairs has its uses.

#

pairs is absolutely useless though indeed.

woeful rose
#

Isn’t pairs just a bit faster?

rotund saddle
#

depends on what you doing

pastel stream
woeful rose
#

Most of my expensive iteration just does i = 1, number

pastel stream
#

next is the fastest, but I recommend generalized.

pastel stream
#

Look at my benchmark

#

That is one of the slowest options

woeful rose
#

I heard that was one of the fastest iteration methods

pastel stream
#

It's only used for counting

#

For iteration it is slow.

#

Just do

for index, value in someTable do
    
end
woeful rose
#

I’ll change that up next update

bronze arrow
#

interesting seeing next at the top

rotund saddle
#

Because test was unfair

bronze arrow
#

?

rotund saddle
#

Would be correct

bronze arrow
#

index missing?

rotund saddle
#

Was just index vs index and value yea

opaque plover
#

this is so sigma

#

saved

pastel stream
bronze arrow
#

why is next cooking tho

violet comet
#

When i die the inventory stops working

#

cant equip tools

woeful rose
violet comet
woeful rose
#

Does your gui have reset on spawn on by any chance?

violet comet
woeful rose
#

So my assumption to what’s going on is that whatever script you are calling startbackpack from is being reset or deleted

#

Which is why I recommend creating a script in starterplayerscripts and starting it from there instead

violet comet
#

okay i will try that

last dirge
bronze arrow
frank wolf
#

is there any way to make the UI scale instead of Offset? On PC it looks great, but on Mobile it is wayyy too big

#

@woeful rose is this possible with some setting by any chance or will we have to manually change everything to scale ourselves

woeful rose
#

Apologizes, the next update should hopefully address this. For now you could try changing the inventory’s size if on mobile to be smaller

#

I will say though typically modern mobile devices do not have screens that are that small

frank wolf
frank wolf
woeful rose
#

Mmm okay I’ll add code to manually shrink the inventory UI in cases like this.

#

Apologies again

frank wolf
woeful rose
#

Version 2.1

  • Bug fixes
  • Update documentation to add documentation on settings
  • Adds new settings: ShowBackpackIcon, ShowInactiveHotbarSlots
  • Adds LocalScript that starts BackpackManager

Documentation: https://nem999.github.io/BackpackManager/home/

frank wolf
woeful rose
#

This new LocalScript changes the size of the UI to be bigger on TV screens and smaller on small mobile screens

#

It also starts the backpack for you

frank wolf
woeful rose
#

@rotund saddle If you have the time could you see if you're still having dragging issues on the latest version?

#

I think I found what was causing it

rotund saddle
#

Errm I gues

#

I can't cause anything

#

not working anymore

woeful rose
rotund saddle
#

the bug

woeful rose
#

Oh thats good

#

If you come across anything else be sure to let me know

violet comet
#

can we make stacked items in this? @woeful rose like a mining system and we can have multiple ores inside one slot.

acoustic cave
#

good module

maiden tulip
pastel stream
#

It's paid.

pastel stream
#

Have you made a DevForum topic about this yet?

austere pendant
#

Rarity displays and tooltips please 😮

woeful rose
rotund saddle
#

rarity displays 😭

austere pendant
#

Uncommon, Common, Rarities like grow a garden or other games possible mutations of items

rotund saddle
#

That’s your job to add 😃

#

This is just a reskin / remaster of Roblox’s backpack system

trail linden
#

Fr

#

Thats not what this module is for

woeful rose
#

The module has all the tools necessary for you to add custom features like that

pastel stream
visual shore
pastel stream
visual shore
#

smoothness is not more than just know how to animate

pastel stream
#

But yes of course mobile and console support adds complexity.

pastel stream
visual shore
#

ngl didn't see it, I'll look at it when I can

woeful rose
# pastel stream Here's the guy's showcase video: https://www.youtube.com/watch?v=Y-MSuSDVEIg&ab_...

My inventory UI was designed to be flexible, modifiable, intuitive and feature all of the features of a normal backpack system. Which means full controller, mobile and VR support. While I agree people definitely have better skills than me at UI design I also made the choice to design a UI that fits into most games so I didn’t go overboard with the animations and whatnot. The biggest advantage backpackmanager has over others is that if you don’t like something you can likely change it

pastel stream
frank wolf
#

Bug: The first time you force an item into a Player's Character (so in their hand) with a full hotbar, and their backpack is closed, it'll show the "Equip" Frame on it. However, every time after this happens (Until the player resets) this won't happen. Video attached shows what I mean and is explained with my voice as well

rotund saddle
#

Def a bug lol

#

There was a bug similar to that in the past

#

Highlight should not appear on tools that are in the backpack if the backpack is closed of course lol

#

Seems like it should be an easy fix

bronze arrow
rotund saddle
#

Exactly

woeful rose
woeful rose
#

revolutionary fix

#

Version 2.2

  • Fix visual bug
rotund saddle
#

This is huge update

woeful rose
#

@frank wolf if you can confirm that the bug is fixed that would be nice

frank wolf
#

wait nvm found it on github

#

ok ill check mb

woeful rose
#

yes the model always gets updated

#

so you can go to that or to the github for the latest release

frank wolf
#

goat furret

woeful rose
woeful rose
#

Version 2.2.1

Do you have a game that is using BackpackManager? Let me know!

#

Special thanks to @pastel stream for making the icon (he really cooked with it)
And @rotund saddle for doing a lot of early testing

rotund saddle
#

o oke

#

😎

frank wolf
#

mb the links look similiar but its cause theres a normal + 18+ version of the game (its a social game)

woeful rose
frank wolf
frank wolf
#

super minor but noticed this in the .rbxm for Version 2.2.1, but you have PlayersService.LocalPlayer twice in the BackpackScript Local Script

woeful rose
#

The line checks if the LocalPlayer exist if not then it waits for one to be created then it will go to the next or which will be the LocalPlayer

frank wolf
woeful rose
#

:Wait() yields until the LocalPlayer property in the Players Service changes but GetPropertyChangedSignal doesn’t return anything which is why we need the extra or

frank wolf
#

o sorry i meant like why add the entire line PlayersService:GetPropertyChangedSignal("LocalPlayer"):Wait() at all not just the :Wait()

#

like I would just use
local LocalPlayer: Player = PlayersService.LocalPlayer
instead of
local LocalPlayer: Player = PlayersService.LocalPlayer or PlayersService:GetPropertyChangedSignal("LocalPlayer"):Wait() or PlayersService.LocalPlayer

woeful rose
#

ohhhh that’s because if the script is ran in ReplicatedFirst there is a slight chance the script will run before Roblox has created a LocalPlayer

frank wolf
#

oo ok that makes sense thanks

inner moth
# frank wolf oo ok that makes sense thanks

IS THE ABOVE ADDED TO THE LATEST OR NEXT RELEASE, TO WAIT A BIT TO GET THE LOCALPLAYER GOING.. i HAVE SEEN THAT A FEW TIMES IT IS GOOD TO PAUSE A BIT TO LET THE CLIENT GET GOING FIRST.

#

OR SHIZZLE CRAPS OUT.. SOMETIMES

woeful rose
visual shore
#

@woeful rose localplayer is going to always be there

woeful rose
visual shore
woeful rose
#

Yeah this was removed a little bit ago and I was not aware

#

This is what Roblox staff said about it recently

woeful rose
ocean moat
#

I love you!

visual shore
frank wolf
#

a setting i recommend is "ShowToolNumber" which toggles whether or not the number for tool slots shows
its very easy to do without tho just need to set TextTranspenarcy on ToolNum to 1

#

also a setting that disables players being able to click/select backpack items entirely (but also can be done by turning off Interactable on Button)

#

also Perform is misspelt (It says Preform)

woeful rose
woeful rose
woeful rose
#

Version 2.2.2

  • Fixed an error relating to spamming Player:LoadCharacterAsync()
  • Fixed an issue where .ToolEquipped and .ToolUnequipped signals could fire at inconsistent times
  • By default tool numbers will no longer show if the player doesn't have a keyboard available.
  • Updated BackpackScript
  • Added settings:
    IconScale, ShowToolNumber and ToolEquippingDisabled
#

changes have been uploaded under the roblox model and not github yet

woeful rose
#

Roblox moment

bronze arrow
woeful rose
#

its fixed

fierce pulsar
bronze arrow
#

got the quark treatment 🥀

fierce pulsar
#

It either violates or not

#

💔

pastel stream
ocean moat
#

is there a way i can reduce the size on phone? Maybe like 25% smalle, its huge @woeful rose

woeful rose
ocean moat
#

is this a new version?

#

nevermind it seems i had the older version

woeful rose
#

Yeah it’s in the newer version

woeful rose
#

Version 2.2.4

  • Adds function BackpackManager:ResetGui()
  • Remove max hotbar slots check (You can now have more than 10 hotbar slots!)
  • Add signals to check for input device changes
  • Fix tool hovering not working for touch screen laptaps.
  • Fix unrecognized keycodes throwing an error.
  • Fix visibility bug
fierce pulsar
#

I like how this still gets updates

frank wolf
#

cause its goated Goat

haughty basalt
#

Is it possible for other tools to use viewport only and others text only?

woeful rose
undone rock
#

h

haughty basalt
#

is there a way disable the tweening animation? nvm i found it

violet comet
#

does this system have a max inventory size

woeful rose
#

if so no

#

you could practically have infinite but i wouldnt recommend that for performance reasons

#

the module tries being very cautious with iterating through the entire tool list though

violet comet
woeful rose
#

no, you can have an infinite amount

violet comet
#

can i make it limited tho

#

Not infinite

woeful rose
#

yea you can

violet comet
#

what happens when i pick up something and i have reached max? will it not let me pick up

woeful rose
#

the only max there are is max hotbar slots and in that case they would just go to your inventory

violet comet
#

does that mean i get infinite tools in the inventory because i do not want that

woeful rose
#

yes, it would mean that

violet comet
#

i can just modify your system

woeful rose
#

and if you do not want that you simply just do not allow your player to pick up more than a certain amount of tools

#

theres not really any need to modify the system for that

violet comet
#

OG

#

OH

#

thanks

#

i understand this now

haughty basalt
#

Is it possible for the items to have amounts like this?

haughty basalt
haughty basalt
woeful rose
haughty basalt
woeful rose
haughty basalt
#

Its straight from the toolbox, and setting viewports setting to true.

woeful rose
#

Oh the viewport setting? Hmmm I can test that out today

woeful rose
#

just remove the grayline and that should fix it

#

I forgot why I grayed that out i was probably tired or something

#

I'll release a fix prob later today

fast solar
#

is this still maintained?