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

I Cant make a Robloxian face one direction all the time any ideas?

Asked by 8 years ago

I'm new to scripting and i use RobloxWIKI as my recourse for scripts, I cannot seem to find how to do as the title says, i can turn off the players animation but that's as far as i've got any ideas or links to help me?...

0
Are you trying to make the whole character face a certain direction? alphawolvess 1784 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

To disable turning (like when you push a WASD key) there's a humanoid property named 'AutoRotate.' With that off your character will permanently face the direction it was while the property was true. After that, you can script the character's direction.

A script inside the character model:

character = script.Parent
character.humanoid.AutoRotate = false
HRP = character.HumanoidRootPart --I use HumanoidRootPart because this is the only good reference part now that animations can move your torso as well.

y = math.rad(90) --Put in an angle in degrees here and it'll rotate your character along the Y axis
HRP.CFrame = CFrame.new(HRP.Position.X, HRP.PositionY, HRP.Position.Z)*CFrame.Angles(0,y,0)  --Takes the original Position and rotates the part y radians along the Y axis.

Are you making a 2D based game? I can see how this'll be useful for that, good luck!

EDIT: My original script never actually rotated anything... Fixed now!

Ad

Answer this question