of     1   

Zeustice
#225707271Thursday, September 28, 2017 8:12 PM GMT

I have begun setting up a shop in my game. I have a sword in server storage with multiple bool values under it. Each value has a corosponding texture so when one is set true it changes the swords texture. Issue I am having is creating a system where players have multiple values for them to be able to go through them and switch them on or off or an "equip" function basically. I have tried creating a GUI button to toggle one of the values but it has not been working. It is a local script under the text button itself. After further reading I have come to undderstand that I can't use a local script to call on things in server storage so what else would be the solution? My main focus right now is creating a GUI inventory so after you buy the sword value from the shop (I have this working already) it will then go to the inventory that has buttons along with the image of what they bought and they can then toggle true or false on the value. Here is the script: local testswordvalue = game.ServerStorage.Sword:FindFirstChild("TestSword") script.parent.MouseButton1Down:connect(function() if testswordvalue.Value then testswordvalue.Value = true else testswordvalue.Value = false end end) I appreciate any help with this. I am also welcome to any suggestions for what I could be doing differently.
Zeustice
#225707917Thursday, September 28, 2017 8:31 PM GMT

Really need help with this at least with a toggle button for the GUI that changes the values?
Lnxl
#225708096Thursday, September 28, 2017 8:38 PM GMT

So testsword is a value or the sword its self. --Game:Destroy()--
Zeustice
#225709267Thursday, September 28, 2017 9:16 PM GMT

Testsword is the value. The name of the item in server storage is "Sword"
Brandon5220
#225710441Thursday, September 28, 2017 9:46 PM GMT

using string values would be better
Zeustice
#225710958Thursday, September 28, 2017 10:01 PM GMT

If it wouldn't be to much trouble could you please explain how I would go about doing this? I have bool values in place, how would I use string values?
soutenu
#225711433Thursday, September 28, 2017 10:14 PM GMT

just don't use instance values at all and store stuff in an array
Zeustice
#225712131Thursday, September 28, 2017 10:32 PM GMT

Ok I went to the wiki and my understanding is that under my main script in serverscriptstorage I have to create a array table and define each boolvalue under the sword? How would I go about making a GUI button that allows players to set there value to true/false from there? I have been learning scripting for many months now but setting up an inventory and tables has been quite confusing for me.
Zeustice
#225713083Thursday, September 28, 2017 10:57 PM GMT

Could someone please at least clarify for me how I would go about using tables now? Non of the responses to this thread have clarified anything. I just want to set up a shop with an inventory. I have a shop already you can buy the skin it adds +1 to the bool value. Now I am trying to set up an inventory that it shows up in. In the process I have become suck on creating a GUI button that would toggle if the value is true/false. Now I understand that I should probably use tables so I should I approach this logically speaking?
TimeTicks
#225713951Thursday, September 28, 2017 11:21 PM GMT

it would probably be handy to store the string values in replicatedstorage, then simply use remote events to tell the server of the change --rep storage userid sword texture1 texture2 texture3 --local script mousebutton1click local texture = getNextTexture(current) re:FireServer(texture) --server script textures = {texture1='rbxassetid://1123443'} re.onserverevent(plr,texture) serverstorage.sword.texture = textures[texture] just a really basic example
Zeustice
#225716010Friday, September 29, 2017 12:19 AM GMT

Thank you for the response this helps me get a better understanding for how to set up tables. So all those in replicated are the string values? And userid value is the players Id for checking if they have the sword value, is that correct?

    of     1