Text doesn't change when gui button is clicked

Hello! This is a local script in a text button whose purpose is to add one to Value each time the button is pressed.

local Point = Instance.new("IntValue")
Point.Name ="Point"
Point.Value = 0
Point.Parent = script.Parent

script.Parent.MouseButton1Click:Connect(function()
	game.StarterGui.ScreenGui.Change.Text = Point.Value + 1
	print("text")
end)

But the points are not added and the number does not change. Zero left.
Bye! :wave:

1 Like

Your code does not change Point.Value. If it’s supposed to increase, you should add Point.Value += 1, which s the same as Point.Value = Point.Value + 1, and also remove the + 1 from the next line.

local Point = Instance.new("IntValue")
Point.Name ="Point"
Point.Value = 0
Point.Parent = script.Parent

script.Parent.MouseButton1Click:Connect(function()
	Point.Value += 1
	game.StarterGui.ScreenGui.Change.Text = Point.Value
	print("text")
end)

Edit: I didn’t notice the startergui problem that is mentioned in the replies below. @Spellwastaken posted code that may work.

Please always check if its

game.StarterGui.....

This does not change on any GUI, instead
to singleplayer

script.Change.Text = Point.Value + 1

to everyone

-- Ye u need an event for this. the materials are 1 local script, 1 normal script, and 1 event thing

The game.StarterGui has been created many times (too much topic created because of it)

The script still doesn’t work.

local Point = Instance.new("IntValue")
Point.Name ="Point"
Point.Value = 0
Point.Parent = script.Parent

script.Parent.MouseButton1Click:Connect(function()
    Point.Value += 1
	game.Players.LocalPlayer.PlayerGui.ScreenGui.Change.Text =tostring( Point.Value )
	print("text")
end)

If it worked please set it as the solution thanks!

i dont see any errors but im so confused where the script parent is parented to
bc if im not wrong the buttton is screen ui and you requested startergui service again?

When you press it, it writes 1, when you press it one more time, the number one remains.

Try it out man if it worked please set it as the solution thank you so much !

1 Like

you mean that startergui dont need?

is this what your starter gui explorer look like?
Untitled

1 Like

yes because ur uis will go in da player’s uis called PlayerGui

1 Like

i just edited it try it again now thanks! :slight_smile: