Advertisement
HowToRoblox

OnClickTopBarScript

Dec 24th, 2019
1,333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.82 KB | None | 0 0
  1. local plr = game.Players.LocalPlayer
  2.  
  3. local debounce = false
  4.  
  5. local switch = script.Parent.Round
  6.  
  7. local function toggle()
  8.    
  9.     if debounce == true then
  10.        
  11.         debounce = false
  12.        
  13.         switch:TweenPosition(UDim2.new(0.339, 0, 0.5, 0), "Out", "Quart", 1, true)
  14.        
  15.         switch.ImageColor3 = Color3.fromRGB(255, 0, 0)
  16.        
  17.         pcall(function()
  18.            
  19.             game.StarterGui:SetCore("TopbarEnabled", true)
  20.            
  21.         end)
  22.  
  23.                
  24.     elseif debounce == false then
  25.        
  26.         debounce = true
  27.        
  28.         switch:TweenPosition(UDim2.new(1.179, 0, 0.5, 0), "Out", "Quart", 1, true)
  29.        
  30.         switch.ImageColor3 = Color3.fromRGB(35, 255, 68)
  31.        
  32.         pcall(function()
  33.            
  34.             game.StarterGui:SetCore("TopbarEnabled", false)
  35.            
  36.         end)
  37.        
  38.     end
  39.    
  40. end
  41.  
  42.  
  43. script.Parent.MouseButton1Click:Connect(toggle)
  44.    
  45.  
  46. script.Parent.Parent.MouseButton1Click:Connect(toggle)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement