Need help on making a item pickup system

I am working on a Battle Royale type game and I need assistance with creating an item pickup system.

Currently, I have a script cycling through a table of in-game weapons and finding a weapon with the closest distance to adornee a billboard UI to. The issue with this current setup is that:

  • it will eventually have to cycle through hundreds of in-game items
  • it freaks out when the player is in-between items (tries to adornee to both at the same time)
  • it isn’t really user-friendly (players may want an item they are aiming towards instead of closest to)
  • the billboard UI is really responsive to camera movements and can be hard to read when the player is moving their camera to the slightest amount.

Is there any library or learning resource that tackles item pickup systems similar to that of Fortnite or BOTW? Anything helps me out!

For a computer experience atleast, I think I would utilize the player’s mouse for this. I might create an event that runs every time the player’s mouse moves, then in the function for that event I might run a condition on the current Target property of the mouse, to determine if it’s loot or not. If it’s loot, I’d enable the according BillboardGui for that piece of loot, and then when the mouse is no longer hovering on that loot disable the BillboardGui. You could also store this condition as a variable, something like

hovered_loot = (mouse.Target and is_loot and mouse.Target) --some condition to determine if it's loot

and you could then use that variable from other events when the player attempts to pick it up.

Hope this helps!

1 Like