Nebula Posted December 16, 2019 Share Posted December 16, 2019 How to make the delta of an item be spent without being in hands? Show an example. Link to comment Share on other sites More sharing options...
Nebula Posted December 19, 2019 Author Share Posted December 19, 2019 (edited) Help me please. I'm trying to solve the problem myself, but it doesn’t work ... I need to find the item in the inventory, read its current delta and reduce it. What am I doing wrong? function WorkDelta (items, player) for i=0, items:size()-1 do if items:get(i):getType() == "WorkItem" then items:setUsedDelta((getUsedDelta() - 0.001)); end end Edited December 19, 2019 by Nebula Link to comment Share on other sites More sharing options...
tommysticks Posted December 20, 2019 Share Posted December 20, 2019 Hey man, you may need to define items yourself: local items = player:getInventory():getItems() I’m on mobile and can’t check if I got this correct, but try that Nebula 1 Link to comment Share on other sites More sharing options...
Nebula Posted December 21, 2019 Author Share Posted December 21, 2019 (edited) 9 hours ago, tommysticks said: Hey man, you may need to define items yourself: local items = player:getInventory():getItems() I’m on mobile and can’t check if I got this correct, but try that Thank you, problem solved. Here is the correct code that I got. function WorkDelta(items, player) local player = getPlayer(); for i = 0, player:getInventory():getItems():size() - 1 do local item = player:getInventory():getItems():get(i); if item:getType() == "WorkItem" then item:setUsedDelta((item:getUsedDelta() - 0.01)); end end Edited December 21, 2019 by Nebula tommysticks 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now