Hi, so recently, I was trying to make my own game that features robot beings trying to come get you, while you have to collect 5 objects in order to beat them. But when you click on an object, it just disappears, and doesn't change the "Objects Left" in the StarterGui, it stays at 5? Anybody know how to fix this?
GIF Of this happening: https://gyazo.com/103f2a4eee89d853d5ebb45d14e4fc82
Changing the StarterGui won't work because the contents of StarterGui are cloned to the player's PlayerGui on spawn. You need to access the player's PlayerGui from a click detector part and change the text label from there. This is how I'd do it:
local object = script.Parent local objectValue = Instance.new("IntValue", object) object.ClickDetector.MouseClick:connect(function(player) local playerGui = player.PlayerGui local gui = playerGui.ScreenGuiName.TextLabelName --change the names gui.Text = objectValue.Value + 1 object:Destroy() end)
Change the names above to your gui and you're good to go. Let me know if you are confused, I'll explain more.