I just figured out how to script teleportation but I still haven’t perfected it.Therefore, I need the forum’s help.
I built two portals and made the scripts:
This has happened to me before too, I would suggest to add a offset to your designated CFrame so when the player gets teleported, they don’t get immediately teleported back. You can also just add a debounce/cooldown between portal teleports. Hope this helps!
Oh, that’s fine, in your teleport CFrame, tweak the last part which is “-138” to maybe “-141”. Just mess with the last value in the CFrame, and it should work.
Perfect, that just means you gotta tweak it a little more, This is what the game “Portal” does, it offsets the player when they enter the portal and come out.
As they said before make a debounce. The procedure works like:
local debounce = false -- creates a debounce variable
local cooldown = 2 -- time until the teleporter can be used again
script.Parent.Touched:Connect(function(hit) -- fires when the player touches the teleporter
local humanoid = char.Humanoid
local teleport = script.Parent.TpPart
if humanoid and debounce == false then
debounce = true -- Sets debounce to true
local player = game.Players:GetPlayerFromCharacter(char)
game.ReplicatedStorage.ChangeSky:FireClient(player)
game.Workspace[player.Name].HumanoidRootPart.CFrame = teleport.CFrame
wait(cooldown) -- wait until teleporter can be used again
debounce = false -- reactivate the teleporter
end
end)