Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local gui = script.Parent
- local debounce = false
- local equipped = false
- local tweenService = game:GetService("TweenService")
- local tweenInfo = TweenInfo.new(
- 0.25,
- Enum.EasingStyle.Back,
- Enum.EasingDirection.Out,
- 0,
- false,
- 0
- )
- local function animateMask(animateStyle)
- local mask = gui.MaskImage
- mask.Visible = true
- if animateStyle then
- if animateStyle == "down" then
- mask.Position = UDim2.new(0, 0, -1, 0)
- local downMaskTween = tweenService:Create(mask, tweenInfo, {Position = UDim2.new(0, 0, 0, 0)})
- downMaskTween:Play()
- elseif animateStyle == "up" then
- mask.Position = UDim2.new(0, 0, 0, 0)
- local upMaskTween = tweenService:Create(mask, tweenInfo, {Position = UDim2.new(0, 0, -1, 0)})
- upMaskTween:Play()
- end
- end
- end
- local function toggleMask()
- if debounce == false then
- if equipped == false then
- debounce = true
- equipped = true
- animateMask("down")
- game.ReplicatedStorage.MaskEquipped.Value = "On"
- wait(1)
- debounce = false
- elseif equipped == true then
- debounce = true
- equipped = false
- animateMask("up")
- game.ReplicatedStorage.MaskEquipped.Value = "Off"
- wait(1)
- debounce = false
- end
- end
- end
- gui.MaskButton.MouseEnter:Connect(toggleMask)
Advertisement
Add Comment
Please, Sign In to add comment