So I was remaking a Coinflip for a Clicker game into just a normal game! But it wont update the bux!
local remotes = game.ReplicatedStorage remotes.Coinflip.OnServerEvent:Connect(function(plr,bet,result) local bux = game.StarterGui.GameGUI.bux.buxAmount.Value if bux >= bet and bux > 0 then if result == "win" then bux = bux + bet; game.StarterGui.GameGUI.bux.Visible = false game.StarterGui.GameGUI.bux.Text = bux game.StarterGui.GameGUI.bux.buxAmount.Value = bux wait(0.05) game.StarterGui.GameGUI.bux.Visible = true print(plr.Name .. " JUST WON!") else bux = bux - bet; game.StarterGui.GameGUI.bux.Visible = false game.StarterGui.GameGUI.bux.Text = bux game.StarterGui.GameGUI.bux.buxAmount.Value = bux wait(0.05) game.StarterGui.GameGUI.bux.Visible = true print(plr.Name .. " JUST LOST!") end end end)
remotes = game.ReplicatedStorage remotes.Coinflip.OnServerEvent:Connect(function(plr,bet,result) local bux = game.StarterGui.GameGUI.bux.buxAmount.Value if bux >= bet and bux > 0 then if result == "win" then bux = bux + bet; game.StarterGui.GameGUI.bux.Visible = false for _,p in pairs(game.Players:GetPlayers()) do p.PlayerGui.GameGUI.bux.Text = bux end game.StarterGui.GameGUI.bux.buxAmount.Value = bux wait(0.05) game.StarterGui.GameGUI.bux.Visible = true print(plr.Name .. " JUST WON!") else bux = bux - bet; game.StarterGui.GameGUI.bux.Visible = false for _,p in pairs(game.Players:GetPlayers()) do p.PlayerGui.GameGUI.bux.Text = bux end game.StarterGui.GameGUI.bux.buxAmount.Value = bux wait(0.05) game.StarterGui.GameGUI.bux.Visible = true print(plr.Name .. " JUST LOST!") end end end)
Two errors here:
Pay attention to lines 7 and 8 and lines 17 and 18. These modify the PlayerGui.
Local variables will not work, use regular variables. I still don't understand why people keep using them; they are meant for their native code block.