Error on portal teleportation script

Hello, I’m making a portal teleportation script for my Speedrun game. An error appeared when I tested the script and the portal didn’t function as it was suppose to. I tried to fix it but the error still appeared.

1 Like

At the end of the code type end)

1 Like

Moving the humanoidRootPart does not work, Maybe try using PivotTo

local Teleport = script.Parent.Teleport
local NextLevelSpawn = script.Parent.TeleportPart

Teleport.Touched:Connect(function(hit)
	if hit.Parent and hit.Parent:IsA("Model") then
		hit:PivotTo(NextLevelSpawn.CFrame)
	end
end)
2 Likes

Thank you everyone for helping, my teleportation script finally worked!

1 Like