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

How to change NumberValue with script?

Asked by
tek_o 56
6 years ago

I am trying to change a number value with a script. Can someone please help me? This is what I have now:

script.Parent.MouseButton1Click:Connect(function()
    game.StarterGui.Frame.TextButton.Text = game.Workspace.Number.Value
end)

What is wrong with this script??

0
why are you changing startergui unmiss 337 — 6y
0
Oh god, thanks so much. I can't believe I did that lol. tek_o 56 — 6y
0
Edited. User#19524 175 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago

To edit a GUI, you have to call PlayerGui from the player, not the StarterGui

0
Says it's not a valid member of ScreenGui tek_o 56 — 6y
Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

StarterGui

This is a common mistake. PlayerGui clones out of StarterGui every respawn if ResetPlayerGuiOnSpawn is set to true. So, if you edit something in StarterGui, it won’t show until you reset.

PlayerGui

This is where the actual GuiObjects are in. If you edit a property from a GUI in PlayerGui, it will show right away, as this is the live GUI.

script.Parent.MouseButton1Click:Connect(function()
    game.Workspace.Number.Value = YOUR NUMBER HERE
end)
0
I'm not looking to display the number, I'm looking to change it. tek_o 56 — 6y
0
I have a Gui with a text box and a button. I want the number in the text box to be the number in the value after the button is pressed. In other words, the player selects the number. tek_o 56 — 6y

Answer this question