New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

How to force a player to look a certain direction?

Asked by 4 years ago

How do I stop a player from rotating his/her character around? Kind of like mouselock except without the ability to turn around.

1 answer

Log in to vote
5
Answered by 4 years ago

This is a lot easier than what you might think. Their is a boolean value named AutoRotate inside of the Humanoid, now using it is also very easy. I'll just show you how to do it by using the touched event.

script.Parent.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then -- need a humanoid first!
        hit.Parent.Humanoid.AutoRotate = false -- That's all! Easy!     
    end
end)

If you don't understand something, all you need to do is Comment bellow or PM me on ROBLOX! You can change AutoRotate with a GUI or ChatCommand, Etc! Please Accept and Plus1 if I helped!

  • true allows a player to rotate
  • false will not allow a player to rotate, even in FirstPerson!
  • Whatever direction you're facing when autoRotate is false, is the direction you're stuck in!
0
Thanks! Neon_N 104 — 9mo
Ad

Answer this question