Advertisement
Cakey3101

2D Platformer Game - EP 3 - CurrencyHandler

Oct 22nd, 2024
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.72 KB | Source Code | 0 0
  1. local Players = game:GetService("Players")
  2. local Player = Players.LocalPlayer
  3. local PlayerGui = Player.PlayerGui
  4. local Gui = PlayerGui:WaitForChild("MainUI")
  5. local Frame = Gui.Frame
  6. local Label = Frame.Diamonds -- Replace "Diamonds With Your Currency"
  7.  
  8. local Leaderstats = Player:WaitForChild("leaderstats")
  9. local Diamonds = Leaderstats:WaitForChild("YourCurrencyHere")
  10.  
  11. local function UpdateDiamonds(newValue) -- Change UpdateDiamonds To UpdateYourCurrencyNameHere
  12.     Label.Text = "Diamonds: " .. tostring(newValue) -- Same Here Change Diamonds To Like Coins Or Sapphires
  13. end
  14.  
  15. UpdateDiamonds(Diamonds.Value) -- Change The Function Here
  16.  
  17. Diamonds.Changed:Connect(function(newValue) -- And Here
  18.     UpdateDiamonds(newValue)
  19. end)
  20.  
Tags: robloxstudio
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement