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

How to Rotate a Player?

Asked by 6 years ago

I have this script which teleports a player. However, when teleported, the player is facing opposite of how I want it to face. How can I fix this?

home = game.Teams.Home
away = game.Teams.Away



wait(7)
local Players = game.Players:GetPlayers()
    for i = 1, #Players do
    if Players[i].Team == home then
    local spawn = game.Workspace.Offense.Part
    Players[i].Character.Torso.CFrame = CFrame.new(spawn.Position)
    end
end

1 answer

Log in to vote
1
Answered by 6 years ago

we could make the player face the back of its torso via CFrames, making the player face the right way(also if u didnt know already CFrames have a Position and a lookAt, like CFrame.new(Position, LookAt)):

home = game.Teams.Home
away = game.Teams.Away



wait(7)
local Players = game.Players:GetPlayers()
    for i = 1, #Players do
    if Players[i].Team == home then
    local spawn = game.Workspace.Offense.Part
    Players[i].Character.Torso.CFrame = CFrame.new(spawn.Position, (Players[i].Character.Torso.CFrame * CFrame.new(0,0,-Players[i].Character.Torso.Size.Z)).p)
    end
end
0
Thank you! Ftlicious 16 — 6y
Ad

Answer this question