Advertisement
CAT_SUS

BloxFruitBypassTeleport.lua

Sep 3rd, 2023 (edited)
44,909
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.11 KB | None | 0 0
  1. --[[ MAKE BY XCAT SUS]] --
  2. -- Luau
  3.  
  4. local BloxFruitTeleporter = {
  5.     Teleport = false,
  6.     Target = nil,
  7.     MobModel = {}
  8. }
  9.  
  10. BloxFruitTeleporter.TeleportSpeed = 300
  11. BloxFruitTeleporter.MaxDistance = 50
  12.  
  13. local TweenService = game:GetService('TweenService')
  14. local Player = game:GetService('Players').LocalPlayer
  15. local lastSpawm = workspace:GetServerTimeNow()
  16. local RootPart = "HumanoidRootPart"
  17.  
  18. local function GetNormalPhysicalProperties()
  19.     return PhysicalProperties.new(0.85,0.4,0.6,1.1,1.1)
  20. end
  21.  
  22. local function NoPhysics()
  23.     if Player.Character then
  24.         for i,v:BasePart?|UnionOperation? in ipairs(Player.Character:GetChildren()) do
  25.             if v:isA('BasePart') or v:isA('UnionOperation') then
  26.                 v.Velocity = Vector3.new(0,0,0)
  27.                 v.CustomPhysicalProperties = GetNormalPhysicalProperties()
  28.             end
  29.         end
  30.     end
  31. end
  32.  
  33. function BloxFruitTeleporter:Start(target:BasePart?|Instance?|Model?|Vector3?|CFrame?,ModelTarget)
  34.     if (workspace:GetServerTimeNow() - lastSpawm) < 1 then
  35.         return
  36.     end
  37.  
  38.     if typeof(target)=="Instance" then
  39.         if target:isA("Model") then
  40.             target = target:GetPivot()
  41.         else
  42.             target = target.CFrame
  43.         end
  44.     end
  45.  
  46.     if typeof(target)=="Vector3" then
  47.         target = CFrame.new(target)
  48.     end
  49.  
  50.     ModelTarget = ModelTarget or Player.Character
  51.  
  52.     if ModelTarget == Player.Character then
  53.         BloxFruitTeleporter.Target = target
  54.         BloxFruitTeleporter.Teleport = true
  55.     else
  56.         BloxFruitTeleporter.MobModel[ModelTarget] = {}
  57.         BloxFruitTeleporter.MobModel[ModelTarget].Target = target
  58.         BloxFruitTeleporter.MobModel[ModelTarget].Teleport = true
  59.     end
  60.  
  61.     local RootPart = ModelTarget:FindFirstChild(RootPart) or ModelTarget.PrimaryPart
  62.     local Distance = (RootPart.Position - target.Position).Magnitude
  63.  
  64.     NoPhysics()
  65.  
  66.     if math.floor(Distance) >= BloxFruitTeleporter.MaxDistance then
  67.         local Time = (Distance / BloxFruitTeleporter.TeleportSpeed)
  68.         local Funtion = TweenService:Create(RootPart,TweenInfo.new(Time,Enum.EasingStyle.Linear),{CFrame = target})
  69.  
  70.         repeat task.wait(0.1)
  71.             NoPhysics()
  72.             Funtion:Play()
  73.         until math.floor((RootPart.Position - target.Position).Magnitude) <= BloxFruitTeleporter.MaxDistance or (not BloxFruitTeleporter.Teleport and  ModelTarget == Player.Character) or (target ~= BloxFruitTeleporter.Target and  ModelTarget == Player.Character)
  74.  
  75.         Funtion:Pause()
  76.  
  77.         if BloxFruitTeleporter.Teleport and target == BloxFruitTeleporter.Target then
  78.             TweenService:Create(RootPart,TweenInfo.new(0.3),{CFrame = target}):Play()
  79.         end
  80.  
  81.     else
  82.         if  math.floor(Distance) >= BloxFruitTeleporter.MaxDistance / 2 then
  83.             TweenService:Create(RootPart,TweenInfo.new(0.3),{CFrame = target}):Play()
  84.         else
  85.             RootPart.CFrame = target
  86.             NoPhysics()
  87.         end
  88.     end
  89.  
  90.     if BloxFruitTeleporter.MobModel[ModelTarget] then
  91.         BloxFruitTeleporter.MobModel[ModelTarget].Target = target
  92.         BloxFruitTeleporter.MobModel[ModelTarget].Teleport = false
  93.     end
  94.  
  95.     BloxFruitTeleporter.Teleport = true
  96. end
  97.  
  98. function BloxFruitTeleporter:Stop()
  99.     BloxFruitTeleporter.Target = nil
  100.     BloxFruitTeleporter.Teleport = false
  101. end
  102.  
  103. function BloxFruitTeleporter:ConfixPart(name)
  104.     RootPart = name
  105. end
  106.  
  107. return BloxFruitTeleporter
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement