Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Teleport player rotation? (Solved)

Asked by 10 years ago

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

Log in to vote
3
Answered by 10 years ago

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.

Ad

Answer this question