I've got a tool, that when activated, will change a value to itself minus one as long as the current value is above 0. Here's the important part of the script:
local matches = game.Lighting.Hardcore.matchesleft.Value Tool.Activated:connect(function() if matches > 0 then print("You have matches") matches = matches - 1 end end)
Alright, so, a bit of explaining --
If you have any ideas as to why this isn't working, please let me know -- I see no reason why it shouldn't.
Edit: The moral here is DON'T get greedy with variable shortcuts!
You probably didn't add the .Value
property by hand correctly.
Try taking .Value
away from the matches variable and make sure you add it by hand carefully to each instance where matches shows up in the anonymous function for the Activated event.