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: Tool Follows Mouse?

Previous Thread :: Next Thread 
ColdUndermined is not online. ColdUndermined
Joined: 25 Jan 2010
Total Posts: 1819
15 Aug 2015 10:31 PM
How do you make a tool follow the mouse?
Report Abuse
ColdUndermined is not online. ColdUndermined
Joined: 25 Jan 2010
Total Posts: 1819
15 Aug 2015 11:24 PM
Bump
Report Abuse
GraphicsSettings is not online. GraphicsSettings
Joined: 12 Sep 2013
Total Posts: 2883
15 Aug 2015 11:25 PM
bodyvelocity?
bodyforce?
bodygyro?
bodyposition?
Report Abuse
71428 is not online. 71428
Joined: 06 Aug 2015
Total Posts: 339
15 Aug 2015 11:25 PM
Mouse position combined with BodyPosition and BodyGyro
Report Abuse
ColdUndermined is not online. ColdUndermined
Joined: 25 Jan 2010
Total Posts: 1819
15 Aug 2015 11:45 PM
How do I get the MousePosition?
Report Abuse
71428 is not online. 71428
Joined: 06 Aug 2015
Total Posts: 339
15 Aug 2015 11:56 PM
local mouse = Player:GetMouse()
mouse.Hit --The position which is a CFrame value
Report Abuse
ColdUndermined is not online. ColdUndermined
Joined: 25 Jan 2010
Total Posts: 1819
16 Aug 2015 12:28 AM
So? Something like this:

while true do
wait()
Tool.Handle.BodyGyro.cframe = CFrame.new(Tool.Handle.Position, mouse.hit)
end

Only problem is it tells me: Vector3 Expected, Got CFrame. Then when I switch it it says CFrame expected, Got Vector3
Report Abuse
ColdUndermined is not online. ColdUndermined
Joined: 25 Jan 2010
Total Posts: 1819
16 Aug 2015 12:29 AM
I also don't see were the BodyPosition comes into this?
Report Abuse
71428 is not online. 71428
Joined: 06 Aug 2015
Total Posts: 339
16 Aug 2015 12:30 AM
while true do
wait()
Tool.Handle.BodyGyro.cframe = CFrame.new(Tool.Handle.Position, mouse.Hit.p)
end
Report Abuse
teamkilled is not online. teamkilled
Joined: 14 Apr 2013
Total Posts: 1748
16 Aug 2015 12:30 AM
BodyPosition would be a smooth slide (like a tween), but setting cframe/vector3 is an immediate change
Report Abuse
ColdUndermined is not online. ColdUndermined
Joined: 25 Jan 2010
Total Posts: 1819
16 Aug 2015 12:35 AM
Ok, now I have the difficulty of the player moving with the mouse. How can I make only the tool part move instead of the whole player?
Report Abuse
71428 is not online. 71428
Joined: 06 Aug 2015
Total Posts: 339
16 Aug 2015 12:36 AM
If the tool is welded to the player it will move the player with it.
Report Abuse
teamkilled is not online. teamkilled
Joined: 14 Apr 2013
Total Posts: 1748
16 Aug 2015 12:37 AM
Tools are welded to the player so you have to make the part that you want to tween to the mouse separate from the tool or not welded to the player
Report Abuse
teamkilled is not online. teamkilled
Joined: 14 Apr 2013
Total Posts: 1748
16 Aug 2015 12:37 AM
714 you win you beat me
Report Abuse
ColdUndermined is not online. ColdUndermined
Joined: 25 Jan 2010
Total Posts: 1819
16 Aug 2015 12:38 AM
And how do you unweld a part from the player? Also, if its unwelded won't it just fall to the ground?
Report Abuse
teamkilled is not online. teamkilled
Joined: 14 Apr 2013
Total Posts: 1748
16 Aug 2015 12:39 AM
you unweld by not putting a weld script in the first place

and yes, unachored and unwelding makes the brick fall
Report Abuse
71428 is not online. 71428
Joined: 06 Aug 2015
Total Posts: 339
16 Aug 2015 12:40 AM
Assuming the script is placed inside the tool you can just do something like;
local weld = script.Parent:FindFirstChild("Weld")
if weld ~= nil then
weld:Destroy()
end

"Also, if its unwelded won't it just fall to the ground?"
That's where BodyPosition comes in. You can place one inside the tool to keep it floating at whatever position you want. BodyGyro is used to just point the object in a certain direction.
Report Abuse
ColdUndermined is not online. ColdUndermined
Joined: 25 Jan 2010
Total Posts: 1819
16 Aug 2015 12:58 AM
Now the hands just float and fling around(even when positioned), not directly ahead of the player
Report Abuse
ColdUndermined is not online. ColdUndermined
Joined: 25 Jan 2010
Total Posts: 1819
16 Aug 2015 01:08 AM
Im wanting them to move around up and down in direction with the mouse, not side to side.
Report Abuse
teamkilled is not online. teamkilled
Joined: 14 Apr 2013
Total Posts: 1748
16 Aug 2015 01:09 AM
You said a tool that follows mouse not hands that follow mouse
those are two completely different things that are scripted completely different
Report Abuse
ColdUndermined is not online. ColdUndermined
Joined: 25 Jan 2010
Total Posts: 1819
16 Aug 2015 01:09 AM
Oh... Sorry, thought they were directly related.
Report Abuse
ColdUndermined is not online. ColdUndermined
Joined: 25 Jan 2010
Total Posts: 1819
16 Aug 2015 01:10 AM
If this helps, the object is a gun. Im trying to allow it to move up and down when in first person. (following were the mouse is)
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