Advertisement
4zx16

Badge Only GUI

Jun 8th, 2022 (edited)
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.94 KB | None | 0 0
  1. --[[
  2.  || 📜 AUTHOR: @4zx16 || BADGE ONLY GUI
  3. ]]
  4. local BadgeService = game:GetService("BadgeService")
  5. local PlayerService = game:GetService("Players").LocalPlayer
  6. local BADGE_ID = 0
  7. --[[
  8. ---------------------------------------------------------------------
  9.                       VARIABLES:
  10. ----------------------------------------------------------------------
  11. --]]
  12. local function OpenOrClose()
  13.     local main = script.Parent.Parent.main
  14.    
  15.     if main.Visible == true then
  16.         main.Visible = false
  17.     else
  18.         main.Visible = true
  19.     end
  20. end
  21. ----- IF PLAYER HAS BADGE -------------------------
  22. script.Parent.MouseButton1Click:Connect(function()
  23.     if BadgeService:UserHasBadgeAsync(PlayerService.UserId, BADGE_ID) then
  24.         OpenOrClose()
  25. ------ IF PLAYER DON'T HAVE BADGE ------------------
  26.     elseif not BadgeService:UserHasBadgeAsync(PlayerService.UserId, BADGE_ID) then
  27.         PlayerService:Kick(PlayerService.Name.. " doesn't own required badge")
  28.     end
  29. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement