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
 

Face in Direction

Previous Thread :: Next Thread 
HatLicense is not online. HatLicense
Joined: 16 Mar 2015
Total Posts: 330
16 Oct 2016 05:22 PM
When I click I'd like the player to face in the direction I clicked and then go back to normal, how can I do this?
Report Abuse
Mr_Gibus is not online. Mr_Gibus
Joined: 17 Jun 2012
Total Posts: 368
16 Oct 2016 05:26 PM
This is a layered script but here are some links that can help you.

http://wiki.roblox.com/index.php?title=API:Class/Mouse
http://wiki.roblox.com/index.php?title=CFrame

Here is a pastbin of part of the code you will need

GhTk8Yy3
Report Abuse
HatLicense is not online. HatLicense
Joined: 16 Mar 2015
Total Posts: 330
16 Oct 2016 05:49 PM
uh what I mean is, I do this -

function repos(part,mouse)
part.CFrame = CFrame.new(part.CFrame.p,mouse)
end

repos(plr.Character.Torso,mouse.Hit.p)

but my problem is, when it's over they have to jump in-order to actually go back to properly standing, if they shoot upward or downward they're left kinda tilted, how can I fix this?
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
16 Oct 2016 05:50 PM
Turn off AutoRotates in their humanoid. The game tries desperately to rotate the character correctly in mid-air if you dont.
Report Abuse
HatLicense is not online. HatLicense
Joined: 16 Mar 2015
Total Posts: 330
16 Oct 2016 05:54 PM
That never fixed my current problem tho ;-;
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
16 Oct 2016 05:56 PM
Well of course it does.

If you turn off AutoRotates it will prevent the game from trying to rotate your character. Duh... hence "Auto Rotate"


Turning that off will force your character to look in that direction.

If you want them to stop trying to turn up and down, multiply the mouse's position by Vector3.new(1,0,1) and add Vector3.new(0,thing.Position.Y,0) so that it will now be at the same height as 'thing'
Report Abuse
HatLicense is not online. HatLicense
Joined: 16 Mar 2015
Total Posts: 330
16 Oct 2016 05:58 PM
No, I've tried the AutoRotate thing and it still leaves my character lob sided, I want them to be able to fire up and down I just don't want it to leave them tilted once they do
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
16 Oct 2016 05:59 PM
If you want them to 'fire' up and down then move the arms instead of the torso by using the C1 of the joints and angling it based on the Y
Report Abuse
wonderful72pike is online. wonderful72pike
Joined: 13 Jul 2010
Total Posts: 7009
16 Oct 2016 05:59 PM
Take the mouse's position and form a new vector that ignores the Y axis.
Report Abuse
caca50 is not online. caca50
Joined: 10 Jul 2011
Total Posts: 2037
16 Oct 2016 06:04 PM
Turn auto rotate off when you're attempting to make them face a direction, then turn it back on when you're done. Also, ignore the y-axis (well technically don't ignore it, just set the y-axis to the y coordinate of the torso's CFrame)
Report Abuse
HatLicense is not online. HatLicense
Joined: 16 Mar 2015
Total Posts: 330
16 Oct 2016 06:09 PM
plr = game.Players.LocalPlayer
m = plr:GetMouse()
char = plr.Character

script.Parent.Activated:connect(function()

plr.Character.Humanoid.AutoRotate = false

local tpos = char.Torso.CFrame.p
char.Torso.CFrame = CFrame.new(char.Torso.CFrame.p,m.hit.p)

wait(1)

plr.Character.Humanoid.AutoRotate = true
char.Torso.CFrame = CFrame.new(tpos)

end)

uh... it's not working ;-;
Report Abuse
caca50 is not online. caca50
Joined: 10 Jul 2011
Total Posts: 2037
16 Oct 2016 06:12 PM
plr = game.Players.LocalPlayer
m = plr:GetMouse()
char = plr.Character or plr.CharacterAdded:wait()
local hum = char:WaitForChild('Humanoid')

script.Parent.Activated:connect(function()

hum.AutoRotate = false

local tpos = char.Torso.CFrame.p
char.Torso.CFrame = CFrame.new(char.Torso.CFrame.p,Vector3.new(m.Hit.X,char.Torso.CFrame.Y,m.Hit.Z))

wait(1)

hum.AutoRotate = true

end)

try that
Report Abuse
HatLicense is not online. HatLicense
Joined: 16 Mar 2015
Total Posts: 330
16 Oct 2016 06:19 PM
I want the player to be able to fire upwards and downwards though and I don't mind if they face up or down during the cast but once it's finished I'd like if they stood straight ;c
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
16 Oct 2016 06:21 PM
Move their arms instead of their torso then ._.

Also simply reset their cframe to look at their own position but moved forward (ignoring Y axis)
Report Abuse
BJCarpenter is online. BJCarpenter
Joined: 04 Nov 2008
Total Posts: 4416
16 Oct 2016 07:05 PM
take uber shotgun from the Library. It Faces Player in the direction you shot. It's a big hunk of fudge, but maybe you will get some ideas from the code.
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