Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you fix GUI button clicking and player reloading?

Asked by 3 years ago

So, I made a script where If I click this button then changes my data value and it does nothing...

local MainGUI = script.Parent local Player = game.Players local Players = game:GetService("Players")

MainGUI.MouseButton1Down:Connect(function(player,character) local Data = Players:WaitForChild"Data" Data.Stand.Value = 2 print("BUTTON NERD") Players:LoadCharacter() end)

1 answer

Log in to vote
0
Answered by
Axenori 124
3 years ago

If it is a local script, then it is likely not working as it is only changing the value on the client, and not the server (where you would probably and should be checking for the players stands, as exploiters can modify the client). Try either making it a server script (not recommended) or a local script but add a remote event and check on the server for if it is legit (to stop exploiters from doing infinite rerolls without currency for example)

0
The server script option is easier but you should always aim to have GUI on the client, the server should be running only important info such as datastores and damage Axenori 124 — 3y
0
This is also why you should replicate visual effects across clients Axenori 124 — 3y
Ad

Answer this question