generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Help with scripting so that torso always faces mouse

Previous Thread :: Next Thread 
iqbal1357 is not online. iqbal1357
Joined: 16 Oct 2010
Total Posts: 238
06 Jun 2015 09:26 PM
How do I script so that the players torso always faces where the mouse is pointing?

I tried using this local script (in starter pack) but it's really glitchy

while wait() do
game:GetService("UserInputService").MouseBehavior = Enum.MouseBehavior.LockCenter
local player = game.Players.LocalPlayer
local Mouse = player:GetMouse()
Mouse.Move:connect(function()
local char = player.Character
local torso = char:WaitForChild("mTorso")
torso.Middle.CFrame = CFrame.new(torso.Middle.CFrame.p, Mouse.Hit.p)
end)
end

I have a custom body welded to the players original body. The mTorso is a model in the body and the Middle is the actual brick that's being used as the torso.

I want it so that it's essentially like a forced mouse shift lock.

I'm trying to create a camera that's similar to those in Ignoble (http://www.roblox.com/games/140847226/Ignoble-Prototype-Free) and Strobe (http://www.roblox.com/games/142524131/Strobe-Read-Description)

If you want to see what I have so far to get a better idea of the problem, you can see here: http://www.roblox.com/games/54066817/Game
Report Abuse
iqbal1357 is not online. iqbal1357
Joined: 16 Oct 2010
Total Posts: 238
06 Jun 2015 09:57 PM
Anyone?
Report Abuse
iqbal1357 is not online. iqbal1357
Joined: 16 Oct 2010
Total Posts: 238
06 Jun 2015 10:32 PM
Bump
Report Abuse
iqbal1357 is not online. iqbal1357
Joined: 16 Oct 2010
Total Posts: 238
07 Jun 2015 07:00 PM
bump
Report Abuse
FunkiAndrew is not online. FunkiAndrew
Joined: 01 Dec 2013
Total Posts: 2318
07 Jun 2015 07:21 PM
I don't think UIS is the best option here.

I think you should hook up a mousehover function
then use the mouseHover.P and do some fancy math to get the torso rotated towards it.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image