I have tried to create a level system with a gui that shows what level you are at but the gui part just wont work here is the script
local player = game.Players.LocalPlayer
local xp = 0
local level = 0
local xpneeded = 100
local levelsgui = script.Parent.Parent.Frame.Levels
local xpgui = script.Parent.Parent.Frame.xp
xpgui.Text = "xp: "..xp
levelsgui.Text = "level: "..level
workspace.Coin.ClickDetector.MouseClick:Connect(function()
xp +=1
if xp == xpneeded then
xpneeded += 100
level +=1
player.leaderstats.Levels.Value +=1
end
end)
xpgui.Text = "xp: "..xp
levelsgui.Text = "level: "..level
script.Parent.MouseButton1Click:Connect(function ()
script.Parent.Parent:WaitForChild("Frame").Visible = not script.Parent.Parent:WaitForChild("Frame").Visible
end)
If you can help me thanks it sill be very appreciated^^

1 comment
Put lines 18 and 19 in the mouseclick function so that the gui updates every click instead of only the first time the script runs.