Leaderboard part-
game.Players.PlayerAdded:connect(function(Player) local leaderstats = Instance.new("IntValue",Player) leaderstats.Name = "leaderstats" local Level = Instance.new("IntValue",leaderstats) Level.Name = "Level" Level.Value = 1 local XP = Instance.new("IntValue",leaderstats) XP.Name = "XP" XP.Value = 5 local Coins = Instance.new'IntValue' Coins.Name = 'Coins' Coins.Parent = leaderstats Coins.Value = 100 local Gems = Instance.new("IntValue",leaderstats) Gems.Value = 5 Gems.Name = "Gems" XP.Changed:connect(function() XPChange(Player,XP,Level) end) end) function XPChange(Player,XP,Level) if XP.Value >= Level.Value*150 then XP.Value = 0 Level.Value = Level.Value+ 1 end end
The script is under Workspace
Gui Part-
while true do wait() local XP = script.Parent.Parent.Parent.Parent.Parent.leaderstats.XP.Value local MaxXP = script.Parent.Parent.Parent.Parent.Parent.leaderstats.Level.Value*150 local math = ( XP / MaxXP ) repeat wait()until script.Parent.Parent.Parent.Parent.Parent script.Parent:TweenSize(UDim2.new(math,0,1,0),"Out","Quad",.25) end
The script is inside a frame which is inside another frame in a screengui.
You have to put the GUI in StarterGui.
If your server is in Filtered Enabled, then you may have to connect a RemoteEvent onto the GUI to allow it to switch teams.