Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Teleport player rotation? (Solved)

I'm working on a warp GUI that teleports a player to a position, but when teleporting, my character faces the wrong direction.

Here is the positioning

torso.CFrame = CFrame.new(Vector3.new(-95.97, 14.59, 263.2))

Is there any way to rotate the character using the CFrame?

Also here is the whole script

permission = {"Player1"} -- Whitelist.

texture = "http://www.roblox.com/asset/id?=" --Shirt ID

function checkOkToLetIn(name) -- This function checks to see if a player is on the whitelist.
	for i = 1,#permission do 
		if (string.upper(name) == string.upper(permission[i])) then return true end --This makes all names uppercase so that we let in BYNDLEY and byndley.
	end 
	return false -- If you're not on the Whitelist, do nothing. 
end 

torso = script.Parent.Parent.Parent.Parent.Parent.Character.Torso --Defining the torso

function onClicked(GUI) -- What happens when you click the button
	if torso.roblox.Texture == texture then --the shirt 
	elseif (checkOkToLetIn(torso.Parent.Name)) then --Checks the whitelist for the player
		torso.CFrame = CFrame.new(Vector3.new(-95.97, 14.59, 263.2)) --Teleports the player to an admin room.
	end 
end 

script.Parent.MouseButton1Click:connect(onClicked) --Activate when a player clicks on the GUI.

All I need is the player to be rotated 90 degrees.

1 answer

✓ Accepted answer

You can either use CFrame.Angles, fromEulerAnglesXYZ, or Rotation.

torso.CFrame = CFrame.new(Vector3.new(-95.97, 14.59, 263.2)) * CFrame.fromEulerAnglesXYZ(0,4,0)

The Y axis interval is 4 because it will take four times to rotate a full 360 degrees using this angle - thus 90 degrees.

This discussion is preserved as it was. New answers, comments, and votes are closed.