#Accessories being universally managed

1 messages · Page 1 of 1 (latest)

mild hill
#

I am trying to create accessories with unique abilities that affect the user, but i am unsure how to go about it. I had an idea of just sending every piece of data from the client through and only use the ones necessary for that accessory but that is too complicated. i am just completely unsure how to make a unique ability for each class whilst keeping the code concise for later additions or reuse.

wooden relicBOT
#

studio** You are now Level 1! **studio

thick blaze
mild hill
#

i am just looking for advice, not necessarily for someone to write it for me but for the way i should go about it because i have no idea how i should make it. the accessories are like things that would make you run faster, or give you a second jump, or an ability to summon things. think terraria accessories.

#

my issue is finding a way to make the accessories unique without having a conditional for each one (example of conditional: if (accessory == "jump boots") then
humanoid.jumpheight = 9)

thick blaze
#

Module example:

local module = {}

function module.JumpBoots(player)
  print(player, "has equipped jump boots")
end)

return module
#

Server example:

local module = require(game.ReplicatedStorage.Modules.AccesoryFunctions)

local onAccesoryEquip = game.ReplicatedStorage.Remotes.OnAccesoryEquip.OnServerEvent

onAccesoryEquip:Connect(function(player, accesory) 
  module[accesory](player)
end)
#

OnAccesoryEquip is a remote event in a folder in replicatedstorage called ‘Remotes’ and module is in a folder in replicatedstorage called ‘Modules’

#

Does this make sense?

mild hill
#

this concept seems like it should work well with what i am trying to accomplish, thanks for the help!