In my Roblox game, I'm trying to do 2 things with my UI: 1. I am trying to make the "Coins: " text = "Coins: " plus the number of coins the player has. 2. I am trying to make a shop Gui show up when you touch a part. But whenever it's updated, it doesn't show up in-game. I checked the properties while running the game and it says "Coins: 10" and "Enabled: True" but it doesn't show up in game, here are some images:

It says "Coins: "  Properties shows "Coins: 10" It says the Gui is enabled Gui doesn't show up

here is the coins script:

local part = script.Parent
local click = part.ClickDetector
local coinsGUI = game.StarterGui.ScreenGui2.TextLabel2
_G.damage = 1
local health = 10
local dealingDamage = false
_G.coins = 0
local coinsWorth = 10

local function onClick()
    while health > 0 do
        dealingDamage = true
        health -= _G.damage
    dealingDamage = false
    health = 0
    part.Transparency = 1
    part.CanCollide = false
    print("okay that works")
    _G.coins += coinsWorth
    print("that works too")
    coinsGUI.Text = "Coins: " .._G.coins
    part.Transparency = 0
    print("i dont see what the problem is then")
    health = 10
    part.CanCollide = true


and here is the shop script:

local part = script.Parent
local confirmGui = game.StarterGui.ScreenGui
local yesButton = confirmGui.TextButton2
local noButton = confirmGui.TextButton


--local function onTouch(coolPerson)
local function onTouch(coolPerson)
    print("function ran")
    local parent = coolPerson.Parent
    if game.Players:GetPlayerFromCharacter(parent) then
        confirmGui.Enabled = true
        print("detects player")

  • \$\begingroup\$ In future, please edit your existing question instead of deleting and re-posting about the same issue. \$\endgroup\$
    – DMGregory
    Commented Jul 21, 2023 at 20:19
  • \$\begingroup\$ I did it because I also wanted to add another error and make it more general, but I could have edited it. \$\endgroup\$ Commented Jul 21, 2023 at 20:47
  • \$\begingroup\$ This could be a problem with client-sided vs. server-sided scripts. Can you tell us where you placed those scripts and whether they run client or server-sided? \$\endgroup\$
    – Philipp
    Commented Jul 22, 2023 at 17:26
  • \$\begingroup\$ I fixed it by using this video \$\endgroup\$ Commented Jul 22, 2023 at 22:28

1 Answer 1


You are modifying the value in StarterGui, not the one in the player's GUI. StarterGUI is only used when a new player joins to give them the GUI.

Modify the GUI inside of game.Players.[PlayerName].PlayerGUI.

In your case, you should do the following:

Script 1:

game.Players:GetPlayerFromCharacter(parent).PlayerGui.Enabled = true

Script 2:

local function onClick(plr)
    plr.PlayerGui.ScreenGui2.TextLabel2.Text = "Coins: " .._G.coins

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .