Is their a way to save multiple different bool values to a player, without just adding heaps of booleans into the player? I have it so when you buy a sword you get it, but I have about 20 swords you can buy, and I don't want 20 values inside the players, so is there a way to save whether a player has brought the sword?
if BOOL_VALUE == true then LOAD_SWORD else TextButton.Text = "Buy Sword" end
Learn how to use DataStores. Trust me, I have experience, I completely redid my whole store system so no values are used, only datastores. and they are fairly simple once you get used to it. For me, I have a storeGui, so I had to use the remote event, but if this is like a store like buttons made of bricks, should be simple. In case you need remoteEvent, i included that too here http://wiki.roblox.com/index.php?title=RemoteFunction_and_RemoteEvent_Tutorial http://wiki.roblox.com/index.php?title=Data_store though if you need some help, contact me through roblox and I can give you a example of my **GUI ** store scripts. But this is only for if you want it to be cross server, really. For the Data Stores, I highly recommend them as they are highly versatile, and is easier then setting up an array. Basically, you set the value in a datastore, and when a player respawns or enters a new game, you could have something like
hasFirstSword = somedatastorethathasbeenaccessedhereandiwillnotexplainhowtodothatbecauseisuckatexplaining if hasFirstSword == true then --insert whateverhere end --repeat
ooooor to make it moreversatile
function give(swordval, anyothervariablesneeded) if swordval:GetAsync(wahteveryourkeyis) == true then --insertwhateverhere end end --run the same function, different sword stores
I think having one function with a interchangable variable would work better then the if statement over and over again. Either way you have to call on the datastore before hand, and I suggest making the key player based, such as
key = player.Name .."_Swords"
just so you dont run into a problem with using the player name only as a key.
You could always create an array within the script (or another more global script) which saves the players name when they buy a particular sword, and when they leave, just delete their name from the list. I can't vouch for data stores since I've not dabbled with them, but unless your system has additional facets not mentioned, I don't see why an array wouldn't work.