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: How can I make part face a mouse's direction...

Previous Thread :: Next Thread 
laughablehaha is not online. laughablehaha
Joined: 19 Apr 2012
Total Posts: 2495
06 Dec 2016 08:25 PM
instead of mouse.Hit.p?

If I was to make a helicopter face my mouse's direction, I would use mouse.hit.p which is kind of a hack and is kinda glitchy, because if I place my mouse on the helicopter, it would jazz out. Help?

LocalScript:

local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local moveEvent = workspace.Part.MoveEvent

game:GetService("RunService").RenderStepped:connect(function()
moveEvent:FireServer(mouse.Hit.p)
end)

--------------------------------------------------------------------------------------------

Script:

local part = workspace.Part
local moveEvent = workspace.Part.MoveEvent

function move(target)
if script.Parent.Parent:findFirstChild("Engine") and engine and engine:FindFirstChild("BodyGyro") then
local mp = engine
local dir = (target - mp.Position).unit local pos = mp.Position + (dir*1)
mp.BodyGyro.cframe = CFrame.new(pos, pos + dir)
mp.BodyGyro.maxTorque = Vector3.new(9000,9000,9000)
end
end

moveEvent.OnServerEvent:connect(function(plr, hitpos)
move(hitpos)
end)
Report Abuse
me2kool2talk2u is not online. me2kool2talk2u
Joined: 19 Feb 2007
Total Posts: 2914
06 Dec 2016 08:28 PM
Set the TargetFilter of the mouse to the Helicopter model. This will make the mouse ignore it.

http://wiki.roblox.com/index.php?title=API:Class/Mouse/TargetFilter
Report Abuse
laughablehaha is not online. laughablehaha
Joined: 19 Apr 2012
Total Posts: 2495
08 Dec 2016 10:21 PM
can i undo the target filter with

"mouse.TargetFilter = nil" ?
Report Abuse
vat21s is not online. vat21s
Joined: 07 Jun 2010
Total Posts: 2508
08 Dec 2016 10:47 PM
Yes you can
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