Advertisement
Cakey3101

ZombieGame - Part 2 Coins Handler Script

Nov 30th, 2024 (edited)
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.57 KB | Source Code | 0 0
  1. local Players = game:GetService("Players")
  2.  
  3. local Player = Players.LocalPlayer
  4. local PlayerGui = Player.PlayerGui
  5.  
  6. local Gui = PlayerGui:WaitForChild("MainUI")
  7. local Frame = Gui.Frame
  8. local CoinsLabel = Frame.Coins.Label
  9.  
  10. local Leaderstats = Player:WaitForChild("leaderstats")
  11. local CoinLeaderstat = Leaderstats:WaitForChild("Coins")
  12.  
  13. local function CoinsChanged(changedAmount)
  14.     CoinsLabel.Text = "Coins: " .. tostring(changedAmount)
  15. end
  16.  
  17. CoinsChanged(CoinLeaderstat.Value)
  18.  
  19. CoinLeaderstat.Changed:Connect(function(changedAmount)
  20.     CoinsChanged(changedAmount)
  21. end)
  22.  
Tags: robloxstudio
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement