Make player teleport with "Custom Part Direction"

Hey!
So, i’m trying to make a system where there are several properties and depending on the availability of plots on the server, the player can have a house at different points on the map. They all point to the front side of the street, so if for example a player spawns in house 1, the front direction of the door is different from house 2, because they are opposite.
image

I’m having problems making them spawn in front of the door, because if I use

player.Character.HumanoidRootPart.CFrame = plotpart.CFrame + Vector3.new(0,0,10)

the third parameter can be different due to the position of the house in the plot

  • How do I find the front door reference?

Full Code:

module.TeleportPlayerToOutside = function(player, part)
	local PlotDoor = part.Parent.Parent.Parent:GetDescendants() --< Plot Folder
	for i, plotpart in pairs(PlotDoor) do
		if plotpart.Name == "NeonDoor" then
			player.Character.HumanoidRootPart.CFrame = plotpart.CFrame + Vector3.new(plotpart.Position)
		end
	end
end

Use the lookVector of PlotPart. :slight_smile:

player.Character.HumanoidRootPart.CFrame = plotpart.CFrame + plotpart.CFrame.LookVector*10
1 Like

aaaand It worked, thank you so much! :grinning:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.