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:
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
wait(1)
health -= _G.damage
print(health)
end
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
print("okay")
part.Transparency = 0
print("i dont see what the problem is then")
health = 10
part.CanCollide = true
end
click.MouseClick:Connect(onClick)
and here is the shop script:
local part = script.Parent
local confirmGui = game.StarterGui.ScreenGui
local yesButton = confirmGui.TextButton2
local noButton = confirmGui.TextButton
print(confirmGui.Enabled)
--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")
end
end
part.Touched:Connect(onTouch)