Hi! I’m trying to set a players CFrame to a part’s when I use a proximity prompt. I have the prompt set up and I know how to do the teleport, but I need help with finding the CFrame of a part. It would be nice to not have to find the exact coordinates every time
local Prompt = script.Parent
Prompt.Triggered:Connect(function(Player)
local Character = Player.Character
local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
local PartToTeleportTo = -- Give Path Here
HumanoidRootPart.CFrame = PartToTeleportTo.CFrame
end)
Try this.
To get a parts CFrame you give it a path of the part then give it .CFrame
local Part = game:GetService("Workspace"):FindFirstChild("Part") -- Finding the part in workspace.
local PartCFrame = Part.CFrame -- Basically getting the parts CFrame
print(PartCFrame) -- Printing whatever the parts CFrame is
Check out CFrame
1 Like