Greetings all,
I have been trying to work this out for hours, I still, clearly have no idea. Basically, I have created a use button for the players inventory, when they use an apple, lets say, it will damage the player(Just for testing purposes). I am using bindable functions with :Invoke() and :OnInvoke(). There is no output errors, and the 'use' button inside the players inventory does nothing!
The code:
-- InventoryModule inside replicated storage inventoryModule.ConsumeItem = function(player, item) local gameItem = game.ReplicatedStorage.Global_Items.Game_Items:FindFirstChild(item.Name) if gameItem then if player then --It passes the if statements item.Use:Invoke(player) --It doesn't invoke? end end end -- Inside a local script, inside a bindable function, inside the item, inside the players inventory folder. Like this: --Player1 --Inventory -- Apple --ImageId --Item Type --Use --UseScript function script.Parent.OnInvoke(player) if player and player.Character then player.Character.Humanoid:TakeDamage(10) end end
Thanks in advance, Brandon. <3
um try to replace line 4 with this
local gameItem = game.ReplicatedStorage.Global_Items.Game_Items:FindFirstChild(item.Name, true)