Advertisement
Herobrinekid2

Untitled

Sep 22nd, 2022
987
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.69 KB | None | 0 0
  1. local Delays = {}
  2. local Cooldown = 1
  3.  
  4.  
  5.  
  6.  
  7. local function CheckLastTeleport(PlrName: string)
  8.    
  9.     if not Delays[PlrName] then
  10.         Delays[PlrName] = os.clock()
  11.         return true
  12.     else
  13.        
  14.         if os.clock() - Delays[PlrName] >= Cooldown then
  15.             Delays[PlrName] = os.clock()
  16.             return true
  17.         else
  18.             return false
  19.         end
  20.        
  21.     end
  22.    
  23. end
  24.  
  25. for _, v in ipairs(script.Parent:GetChildren()) do
  26.    
  27.     if v:IsA("BasePart") then
  28.        
  29.         v.Touched:Connect(function(H)
  30.            
  31.             if H.Parent:FindFirstChild("Humanoid") then
  32.                
  33.                 local Plr = H.Parent
  34.                
  35.                 if CheckLastTeleport(Plr.Name) then
  36.                     Plr:PivotTo(v.To.Value.CFrame + Vector3.new(0,2,0))
  37.                 end
  38.                
  39.             end
  40.            
  41.         end)
  42.        
  43.     end
  44.    
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement