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 » Scripting Helpers
Home Search
 

Re: Is it possible to make a player move to mouse?

Previous Thread :: Next Thread 
enyahs7 is not online. enyahs7
Joined: 25 Apr 2008
Total Posts: 9820
27 Aug 2013 09:17 AM
It seems like it would be hard since they have no object in click detector that determines the coordinates.
Report Abuse
chaokid9 is not online. chaokid9
Joined: 29 Aug 2008
Total Posts: 6187
27 Aug 2013 09:20 AM
Do you mean ANYWHERE they click like a teleport tool, or like click on a specific brick and then it takes you to that brick?
Report Abuse
enyahs7 is not online. enyahs7
Joined: 25 Apr 2008
Total Posts: 9820
27 Aug 2013 09:24 AM
Like lets say I have a baseplate. I was gonna use a click detector to determine if I clicked somewhere in the baseplate ten my player moves to that coordinate. But im not sure how I would do it it doesn't seem possible.
Report Abuse
Desperian is not online. Desperian
Joined: 07 Feb 2012
Total Posts: 3371
27 Aug 2013 09:26 AM
Use the ':GetMouse()' method, the 'Button1Down' event, the 'hit' property of the mouse, and the ':MoveTo()' method for humanoids.
Report Abuse
chaokid9 is not online. chaokid9
Joined: 29 Aug 2008
Total Posts: 6187
27 Aug 2013 09:28 AM
I'm a bit rusty on my scripting so I don't know exactly how to do it, but I can put you in the right direction. I know you don't use a click detector, but there is a property of mouse that gives the game the position of where you clicked. It is something like mouse.hit. It should return a c-frame of where the mouse clicked.
Here it is: http://wiki.roblox.com/index.php/Hit_%28Property%29
Report Abuse
enyahs7 is not online. enyahs7
Joined: 25 Apr 2008
Total Posts: 9820
27 Aug 2013 09:45 AM
I have this so far but If I click how would I get it to move to mouse using mouseOrigin ?

local Player = Game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local char = Player.Character

function move()
char.Humanoid:MoveTo(Mouse.Origin, script.Parent)
Mouse.Origin = char.Torso.Position
end
Mouse.Button1Down:connect(move)
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
27 Aug 2013 09:50 AM
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()

mouse.Button1Down:connect(function()
plr.Character.Humanoid:MoveTo(mouse.Hit.p)
end)
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
27 Aug 2013 09:52 AM
I think the second argument for that function is mandatory.
Report Abuse
enyahs7 is not online. enyahs7
Joined: 25 Apr 2008
Total Posts: 9820
27 Aug 2013 09:57 AM
Ye it says argument 2 missing or nil for the error with using the Mouse.Hit
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
27 Aug 2013 09:58 AM
Try adding script.Parent like you did before.
Report Abuse
enyahs7 is not online. enyahs7
Joined: 25 Apr 2008
Total Posts: 9820
27 Aug 2013 10:05 AM
Thanks guys I actually ended up using Workspace.Baseplate for the baseplate.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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