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

How to change NumberValue with script?

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??

3 comments

0

why are you changing startergui

0

Oh god, thanks so much. I can't believe I did that lol.

0

Edited.

2 answers

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

1 comment

0

Says it's not a valid member of ScreenGui

#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)

2 comments

0

I'm not looking to display the number, I'm looking to change it.

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.

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