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

How can I make the player constantly face only one direction?

Asked by 10 years ago
wait(3)

local player = script.Parent.Parent
local character = player.Character


print("Beforefor")
for _,v in pairs(character:GetChildren()) do
if v.ClassName == ("Part") then

while true do
local h = character.Head
v.CFrame = v.CFrame * CFrame.Angles(v.CFrame.x + 10, v.CFrame.y, v.CFrame.z)
wait(0.5)--0.5
print("DONE")
end
end
end

If you put this in a script and put the script in StarterGui, you can test it out for yourself

Problem: When I use this script, my player spazzes out

What I want to happen: I want the player to constantly face a direction so when I change the camera the controls(based on which way the character is facing) don't get messed up

Any solution? Other ways of doing it?

0
MouseLockSwitch overrides any means of forcing the character to face in any direction. 1waffle1 2908 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

Another way of doing it would be to create a BodyGyro in one of the characters parts (E.g. Head) and set it to face in the direction you want your character to face, but with a high maxTorque. I would probably do something along the lines of:

wait(3)

local Player = script.Parent.Parent
local Character = Player.Character
local Head = Character.Head

local BG = Instance.new("BodyGyro", Head)
BG.maxTorque = Vector3.new(1/0, 1/0, 1/0)
BG.cframe = Head.CFrame * CFrame.Angles(Head.CFrame.x + 10, Head.CFrame.y, Head.CFrame.z)

That's assuming your cframing is correct and that the script's parents parent is the player. You could also try messing around with the .D (Dampening) and the .P (Power) properties if you need to.

Ad

Answer this question