So I was working on a game, and I had a SurfaceGUI in the StarterGUI and its Adornee was set to the brick. The SurfaceGUI shows the player their money, the money that the player has is stored in an IntValue, and each second the TextButton in the SurfaceGUI would get updated, but it would only get updated in the properties menu, not in-game. Help?
--SCRIPT--
script.Parent.MouseButton1Click:connect(function() local plr = script.Parent.Parent.Parent.Parent.Parent.Parent script.Parent.Parent.Visible = false if(plr:FindFirstChild("leaderstats").DjBux.Value >= 140)then script.Parent.Parent.Parent.Yes.Visible = true plr:FindFirstChild("leaderstats").DjBux.Value = plr:FindFirstChild("leaderstats").DjBux.Value - 140 game.StarterGui.SurfaceGui.Frame.money.Money.Value = game.StarterGui.SurfaceGui.Frame.money.Money.Value + 140 game.StarterGui.SurfaceGui.Frame.money.Text = "$: "..game.StarterGui.SurfaceGui.Frame.money.Money.Value --This part works perfectly but the effect won't show on the SurfaceGui, but if i go in the properties of the money text button the text is correct... script.Parent.Parent.Parent.Yes.Visible = true end end)
Ok first off you shouldn't be getting the surface gui located in StarterGui, that's the games that clones to each player. What you want to do is locate the SurfaceGui inside the Players Backpack. Your changing the SurfaceGui located in StarterGui so when you reset it updates, however everyone gets that update not only you. So here is my suggestion:
script.Parent.MouseButton1Click:connect(function() if(plr:FindFirstChild("leaderstats").DjBux.Value >= 140)then script.Parent.Parent.Parent.Yes.Visible = true plr:FindFirstChild("leaderstats").DjBux.Value = plr:FindFirstChild("leaderstats").DjBux.Value - 140 plr.PlayerGui.SurfaceGui.Frame.money.Money.Value = plr.PlayerGui.SurfaceGui.Frame.money.Money.Value + 140 plr.PlayerGui.SurfaceGui.Frame.money.Text = "$: "..plr.PlayerGui.SurfaceGui.Frame.money.Money.Value script.Parent.Parent.Parent.Yes.Visible = true end end)
This locates the SurfaceGui inside the Player, which automatically updates it also doesn't allow others to see your stats on their Surface Gui. If I were you I'd go back through and check your frames and GUI make sure the SurfaceGui is located inside the StarterGui in game, so that it clones into the player's PlayerGui. Hope this helped!