Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to change a value inside a GUI?

This works in the studio but when I try it in game, it doesn't work.

local pl = game.Players.LocalPlayer:FindFirstChild("PlayerGui")
pl.IntroGui.Value.Value = 1

I tried using LocalScript, it didn't work at all.

I think game.Players.LocalPlayer is the mistake but I can't figure it out.

6 comments

0

A LocalScript is necessary, since the server can't access the clients' PlayerGuis' descedants - only when the server parented it. You should also know that everything wouldn't load in immediately. Show the hierarchy of the gui

0

I know that, that's why I'm checking with you. Should I use 'WaitForChild("PlayerGui")'?

0

Have you tried using this as a local script, inside the GUI?

0

I need the script to be in workspace.

0

where is the number value located?

0

The value is located in the Gui and the script in workspace.

1 answer

✓ Accepted answer

Using game.Players.LocalPlayer, you will need a LocalScript.

According to one of your comments, you need your script to be in workspace. In that case, I recommend that you use RemoteEvents for Client-Server communication. Your serverscript will send a request to the Client which will execute that script.

Learn more about remote events HERE

1 comment

0

Thank you for your help, but I decided to put the NumberValue in Workspace.

This discussion is preserved as it was. New answers, comments, and votes are closed.