Teleporting Players to wrong CFrame

For some reason whenever the player exits out of the elevator1-4, they get teleported to the wrong one. I am so confused on why that is happening, I’ve even changed the name for it multiple times. Help would be appreciated.

Portion of the Script:

elevatorEvent.OnServerEvent:Connect(function(player)
	local isWaiting = table.find(playersWaiting, player)
	if isWaiting then
		table.remove(playersWaiting, isWaiting)
	end
	
	gui.Title.Text = #playersWaiting .. "/" .. config.MaxPlayers.Value .. " Players"
	
	if player.Character then
		player.Character.PrimaryPart.CFrame = elevator.TeleportOut2.CFrame
	end
end)

weird

I believe that the CFrame assignment which is player.Character.PrimaryPart.CFrame = elevator.TeleportOut2.CFrame is setting the person’s position to the wrong location.

Some adjustments

elevatorEvent.OnServerEvent:Connect(function(player, elevatorId)
	local isWaiting = table.find(playersWaiting, player)
	if isWaiting then
		table.remove(playersWaiting, isWaiting)
	end
	
	gui.Title.Text = #playersWaiting .. "/" .. config.MaxPlayers.Value .. " Players"
	
	if player.Character then
		local teleportCFrame = DetermineTeleportCFrame(elevatorId) -- This is a hypothetical function
		player.Character.PrimaryPart.CFrame = teleportCFrame
	end
end)

Yeah, that’s what I’m trying to figure out how to fix.

it unfortunately didn’t work, thanks for trying though! :slight_smile: