HowToRoblox

PremiumDoorScript

Mar 3rd, 2020
2,074
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.62 KB | None | 0 0
  1. local door = script.Parent
  2.  
  3.  
  4. local mps = game:GetService("MarketplaceService")
  5.  
  6.  
  7. local isOpen = false
  8.  
  9.  
  10. door.Touched:Connect(function(touch)
  11.    
  12.     local char = touch.Parent
  13.    
  14.     local plr = game.Players:GetPlayerFromCharacter(char)
  15.    
  16.    
  17.     if not plr then return end
  18.        
  19.    
  20.     if plr.MembershipType == Enum.MembershipType.Premium then
  21.        
  22.        
  23.         if isOpen then return end
  24.    
  25.         isOpen = true
  26.        
  27.        
  28.         door.Transparency = 1
  29.         door.CanCollide = false
  30.        
  31.        
  32.         wait(2)
  33.        
  34.        
  35.         door.Transparency = 0
  36.         door.CanCollide = true
  37.        
  38.        
  39.         isOpen = false
  40.        
  41.     else
  42.        
  43.         mps:PromptPremiumPurchase(plr)
  44.        
  45.     end
  46.    
  47. end)
Add Comment
Please, Sign In to add comment