Why isn't this script working?

Hi, so I am trying to make a part that changes the UI when clicked, and it doesn’t seem to work. Nothing happens. There aren’t any errors in the output either so I don’t know what’s going on.
Here is the script:

local part = script.Parent
local detector = part.ClickDetector

detector.MouseClick:Connect(function(player)
	if game.StarterGui.EggCounter.Frame.TextBox2.Text == "0/8" then
		game.StarterGui.EggCounter.Frame.TextBox2.Text = "1/8"
		
	elseif game.StarterGui.EggCounter.Frame.TextBox2.Text == "1/8" then
		game.StarterGui.EggCounter.Frame.TextBox2.Text = "2/8"
		
	elseif game.StarterGui.EggCounter.Frame.TextBox2.Text == "2/8" then
		game.StarterGui.EggCounter.Frame.TextBox2.Text = "3/8"
		
	elseif game.StarterGui.EggCounter.Frame.TextBox2.Text == "3/8" then
		game.StarterGui.EggCounter.Frame.TextBox2.Text = "4/8"
		
	elseif game.StarterGui.EggCounter.Frame.TextBox2.Text == "4/8" then
		game.StarterGui.EggCounter.Frame.TextBox2.Text = "5/8"
		
	elseif game.StarterGui.EggCounter.Frame.TextBox2.Text == "5/8" then
		game.StarterGui.EggCounter.Frame.TextBox2.Text = "6/8"
		
	elseif game.StarterGui.EggCounter.Frame.TextBox2.Text == "6/8" then
		game.StarterGui.EggCounter.Frame.TextBox2.Text = "7/8"
		
	elseif game.StarterGui.EggCounter.Frame.TextBox2.Text == "7/8" then
		game.StarterGui.EggCounter.Frame.TextBox2.Text = "8/8"
		
	elseif game.StarterGui.EggCounter.Frame.TextBox2.Text == "8/8" then
		game.StarterGui.EggCounter.Frame.TextBox2.Text = "hi"
	end
end)

Any help on this would be greatly appreciated.
Thank You.

You’re changing StarterGui, when you should be changing the GUI in Player’s PlayerGui

1 Like

Ok so how would I fix it? Sorry I’m still learning to script.

Nvm I think I got it now tysm for the help!