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: Make a model follow a mouse, in the world.

Previous Thread :: Next Thread 
KiwiTronik is not online. KiwiTronik
Joined: 18 Feb 2010
Total Posts: 3221
02 Oct 2014 10:52 PM
mouse.Move:connect(function()
if mouse.Target ~= nil then

local hitPoint = mouse.Hit:toObjectSpace(script.Parent.NewBP.Value.Union.CFrame).p
script.Parent.NewBP.Value:MoveTo(hitPoint.Position)
end
end)


main part of the script
attempted to take some lines from roblox dragger tool, couldnt quite get it.

~I'm an Angry Llama~
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
02 Oct 2014 11:19 PM
'script.Parent.NewBP.Value:MoveTo(hitPoint.Position)'

.Value:MoveTo

ummm
Report Abuse
KiwiTronik is not online. KiwiTronik
Joined: 18 Feb 2010
Total Posts: 3221
02 Oct 2014 11:20 PM
oops forgot to mention,

NewBP is an object value.

~I'm an Angry Llama~
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
02 Oct 2014 11:22 PM
Oh my bad,

Is there any output?
Report Abuse
KiwiTronik is not online. KiwiTronik
Joined: 18 Feb 2010
Total Posts: 3221
02 Oct 2014 11:26 PM
There is, but heres fixed script:

mouse.Move:connect(function()
if mouse.Target ~= nil then
--script.Parent.NewBP.Value:MoveTo(mouse.h)
local hitPoint = mouse.Hit:toObjectSpace(script.Parent.NewBP.Value.Union.CFrame).p
script.Parent.NewBP.Value:MoveTo(hitPoint)
end
end)

Not output, model glitches around everywhere, when ever i move my mouse, not even close to my mouse.

~I'm an Angry Llama~
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
02 Oct 2014 11:29 PM
'There is, but heres fixed script:'

So you got it fixed or no?
If not can you make it into a model (With the NewBP or whatever else is needed to test it)
Report Abuse
KiwiTronik is not online. KiwiTronik
Joined: 18 Feb 2010
Total Posts: 3221
02 Oct 2014 11:32 PM
plr = game.Players.LocalPlayer
mouse = plr:GetMouse()

mouse.KeyDown:connect(function(key)
if script.Parent.Parent.Visible then
print(key:byte())
if key:byte() == 93 then
script.Parent.Check.Value = "Created"
repeat wait() until script.Parent.NewBP.Value ~= nil
mouse.Move:connect(function()
if mouse.Target ~= nil then
script.Parent.NewBP.Value:MoveTo(mouse.hit.p)

end
end)
end
end
end)

Model now follows mouse, but as mouse moves, the mouse is ontop of the model, and then model appears closer, if that makes sense.


~I'm an Angry Llama~
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
02 Oct 2014 11:37 PM
Try doing it with a single brick rather than a model of parts and see what happens
Report Abuse
KiwiTronik is not online. KiwiTronik
Joined: 18 Feb 2010
Total Posts: 3221
02 Oct 2014 11:53 PM
Wouldnt really change much because the mouse will still be on a part.

~I'm an Angry Llama~
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
02 Oct 2014 11:58 PM
Maybe the mouse is ontop of the model, so it moves the model to where the mouse is on the model, and keeps doing that and thats why it gets closer
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
03 Oct 2014 02:14 AM
Add a check at the :MoveTo to check if your mouse.Target is a member of NewBP.Value
Report Abuse
KiwiTronik is not online. KiwiTronik
Joined: 18 Feb 2010
Total Posts: 3221
03 Oct 2014 02:52 AM
This helps, but cant get precision "moving" when placing this "newbp"

The roblox dragger tool uses what i need, it goes through the part, and gets the next object found. tricky to explain :P

~I'm an Angry Llama~
Report Abuse
KiwiTronik is not online. KiwiTronik
Joined: 18 Feb 2010
Total Posts: 3221
03 Oct 2014 03:46 AM
bump



~I'm an Angry Llama~
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
03 Oct 2014 05:00 AM
Toobjectspace might be wrong

But youll probably need to filter the mouse too since otherwise it can target the same part in the model making it able to fky to infinity
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
03 Oct 2014 05:09 AM
Toobjectspace might be wrong

But youll probably need to filter the mouse too since otherwise it can target the same part in the model making it able to fky to infinity
Report Abuse
Moxiii is not online. Moxiii
Joined: 06 Mar 2012
Total Posts: 1198
03 Oct 2014 09:17 AM
I didn't make much of an attempt to understand this, but, if your problem is mouse.Target becoming a child of a model you don't want targeted, parent it to the player's character.

Pretty sure mouse.Target goes through anything in a character.
Report Abuse
KiwiTronik is not online. KiwiTronik
Joined: 18 Feb 2010
Total Posts: 3221
03 Oct 2014 11:58 PM
@Moxiii

Yayy it works!
Thank you so much!!!!!!@@@!!!!
:D :D



~I'm an Angry Llama~
Report Abuse
cooldude999921 is not online. cooldude999921
Joined: 13 Aug 2011
Total Posts: 3702
04 Oct 2014 12:14 AM
ogm another llama


hi


i'm a whale
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