I am trying to fix this gamepass teleporter, it seems not to work at all. What could be the error with it? I have already tried to group/ungroup it with the teleport to part.

list = {"", ""}


gamepassId = 255509091

exitName = "Tele2"
Exit = script.Parent.Parent:FindFirstChild(ExitName)

local gm = game.GetService("GamePassService")
function onTouch(hit)

	if game.Players:FindFirstChild(hit.Parent.Name) ~= nil and hit.Parent:FindFirstChild("Torso") ~= nil then
		for i = 1, #list do
			if hit.Parent.Name == list[i] then
				isallowed = true
			end
		end
		if isallowed or gm:PlayerHasPass(game.Players:FindFirstChild(hit.Parent.Name), gamepassId)then
			hit.Parent:FindFirstChild("Torso").CFrame = CFrame.new(Exit.CFrame.X, Exit.CFrame.Y + 3, Exit.CFrame.Z)
		end
	end
	isallowed = false
end

script.Parent.Touched:connect(onTouch)

1 comment

0

I assume this is just killing the player? I'm pretty sure C-Framing the Torso is not how you "teleport" a player, you need to use MoveTo()