Sungmingamerpro13

Mask System

Sep 22nd, 2025
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 1.24 KB | None | 0 0
  1. local gui = script.Parent
  2.  
  3. local debounce = false
  4. local equipped = false
  5.  
  6. local tweenService = game:GetService("TweenService")
  7. local tweenInfo = TweenInfo.new(
  8.     0.25,
  9.     Enum.EasingStyle.Back,
  10.     Enum.EasingDirection.Out,
  11.     0,
  12.     false,
  13.     0
  14. )
  15.  
  16. local function animateMask(animateStyle)
  17.     local mask = gui.MaskImage
  18.     mask.Visible = true
  19.     if animateStyle then
  20.         if animateStyle == "down" then
  21.             mask.Position = UDim2.new(0, 0, -1, 0)
  22.             local downMaskTween = tweenService:Create(mask, tweenInfo, {Position = UDim2.new(0, 0, 0, 0)})
  23.             downMaskTween:Play()
  24.         elseif animateStyle == "up" then
  25.             mask.Position = UDim2.new(0, 0, 0, 0)
  26.             local upMaskTween = tweenService:Create(mask, tweenInfo, {Position = UDim2.new(0, 0, -1, 0)})
  27.             upMaskTween:Play()
  28.         end
  29.     end
  30. end
  31.  
  32. local function toggleMask()
  33.     if debounce == false then
  34.         if equipped == false then
  35.             debounce = true
  36.             equipped = true
  37.             animateMask("down")
  38.             game.ReplicatedStorage.MaskEquipped.Value = "On"
  39.             wait(1)
  40.             debounce = false
  41.         elseif equipped == true then
  42.             debounce = true
  43.             equipped = false
  44.             animateMask("up")
  45.             game.ReplicatedStorage.MaskEquipped.Value = "Off"
  46.             wait(1)
  47.             debounce = false
  48.         end
  49.     end
  50. end
  51.  
  52. gui.MaskButton.MouseEnter:Connect(toggleMask)
  53.  
Advertisement
Add Comment
Please, Sign In to add comment