Advertisement
Joriangames

Roblox Seamless Teleport (LocalScript)

Mar 1st, 2023 (edited)
2,543
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.31 KB | None | 0 0
  1. --[[
  2. Thanks for using this script
  3. Want to know how to use this and script explanation?
  4. Check the video here: https://youtu.be/oXBi18J--Xo
  5. ]]
  6. local center1 = workspace.portalA.Center
  7. local center2 = workspace.portalB.Center
  8.  
  9. local canTouch = true --You can remove this line, you don't need it
  10. local plr = game.Players.LocalPlayer
  11.  
  12.  
  13. center1.Touched:Connect(function(hit)
  14.     if hit.Parent:FindFirstChild("Humanoid") then
  15.         local char = hit.Parent
  16.         local player = game.Players:GetPlayerFromCharacter(char)
  17.         local touchValue = player:FindFirstChild("canTouch")
  18.  
  19.         if touchValue.Value == true then
  20.             touchValue.Value = false
  21.             local offset = center1.CFrame:ToObjectSpace(char.HumanoidRootPart.CFrame)
  22.             char.HumanoidRootPart.CFrame = center2.CFrame * offset
  23.             wait(1)
  24.             player.canTouch.Value = true
  25.         end
  26.     end
  27. end)
  28.  
  29. center2.Touched:Connect(function(hit)
  30.     if hit.Parent:FindFirstChild("Humanoid") then
  31.         local char = hit.Parent
  32.         local player = game.Players:GetPlayerFromCharacter(char)
  33.         local touchValue = plr:FindFirstChild("canTouch")
  34.  
  35.         if touchValue.Value == true then
  36.             touchValue.Value = false
  37.             local offset = center2.CFrame:ToObjectSpace(char.HumanoidRootPart.CFrame)
  38.             char.HumanoidRootPart.CFrame = center1.CFrame * offset
  39.             wait(1)
  40.             player.canTouch.Value = true
  41.         end
  42.     end
  43. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement