So, I am making a minigame place, and it has a GUI for the players to click on and pay Robux to pick the next minigame. It works fine, but the only problem is that there is a string value in the workspace. I want to make it so when the button is pressed, it changes it to the value that it's set to.
If i insert a local script into the textbutton and type this code...
script.Parent.MouseButton1Click:Connect(function() workspace.Value.Value = "Obby" end)
..it will only show up to the client. It will not change for the server.
How do i make it so it does change for the server?
Please let me know.
You need to use a remote event, put a remote vent inside of replicated storage, change remote event to the name of your remote event.
Local script inside the button gui
script.Parent.MouseButton1Click:Connect(function() game.ReplicatedStorage.RemoteEvent:FireServer() end)
Server script inside workspace or serverscriptservice
local value = game.Workspace.NumberValue.Value -- Change this to the path of your value game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player) value = value + 1 -- Change this number to how much you want to value to increase each time the button is clicked / pressed end)
If you need any other help please feel free to ask!