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

How can I connect GUI scripts (from the player GUI) to a model in the Work Space?

Asked by 7 years ago

Thank you for those who are taking the time to read and think of the answer to this complicated problem (complicated for me).

I have this model, and it contains Integer Values and GUI's with scripts. One of the scripts in the model, clones the GUI (and its scripts) into the Player GUI section (Players > [PLAYER 1] > PlayerGUI > [GUI cloned from the model]).

I am asking, How can I script the GUI so that while its in the Player GUI, it can edit the Integer Values in the model [Workspace > Model].

Side notes: The model is not in the game at start, I use kohl's admin to insert it into the game. Once you sit in the seat with the GUI, it will clone itself into the Player GUI. The model and Integer Values are still in the Work Space section. If you get out of the seat, The GUI gets removed. All this part is all ready scripted and working. I just need to know how I can make the GUI scripts in the Player GUI section edit something in the Work Space.

Again, Thanks for helping me out.

1 answer

Log in to vote
1
Answered by 7 years ago

Theres 2 ways to do this. One is for FE; other isnt.

Non-FE Method Make sure the script thats going to change the IntValues is a LocalScript. From there on, just use a simple code like

IntValue.Value = 3

FE Method This involves RemoteFunctions or RemoteEvents, whichever you prefer while I prefer Events ;). Get an event in your Workspace, and when its fired from clientside it uses 2 arguments: the specified IntValue and the new Value. Then, to change the IntValue, put something like this in the Event Script.

player = p //Argument 0 (default)
value = iv //Argument 1, the specified IntValue to change.
num = nm // Argument 2, the value.

iv.Value = nm

Hope this helps, comment for any questions.

0
Can you explain to me what FE is? PonyCreated 50 — 7y
0
FilteringEnabled - basically a Property in Workspace that ensures that client changes don't get replicated to the server - just google it. emojipasta 45 — 7y
Ad

Answer this question