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 to move a model with the mouse?

Previous Thread :: Next Thread 
GhostOfAKing is not online. GhostOfAKing
Joined: 25 Apr 2015
Total Posts: 32
04 Feb 2017 07:17 AM
Okay, so please bear with me. I need to enable a player to move an object (model) around with the mouse alone a grid, but I'm not sure how to go about this. I can't seem to get the mouse's 3d position, outside of mouse.Hit.p for obvious reason. I would really appreciate all help if any. Please explain with details, thanks.

I was about to make a model elevator by using SetPrimaryPartCFrame, will this work along those lines are is there another method to moves model frame by frame.

Also is there a more effient way to make an elevator?

Thanks!
Report Abuse
IVgormYT is not online. IVgormYT
Joined: 24 Aug 2016
Total Posts: 485
04 Feb 2017 07:22 AM
Hello! To move a model with your mouse, select the selecter and drag the model to where you want it!

I hope i was to help :)
Report Abuse
Disillusions is not online. Disillusions
Joined: 10 Jul 2011
Total Posts: 6365
04 Feb 2017 07:22 AM
whats wrong with mouse.Hit.p?

if you mean the model blocks the mouses position from registering the part/baseplate underneath, use mouse.TargetFilter and set it to the model


Report Abuse
GhostOfAKing is not online. GhostOfAKing
Joined: 25 Apr 2015
Total Posts: 32
04 Feb 2017 07:50 AM
I guess I should have mentioned, I have also been unable to drag a single part. Mouse.Hit.p DOES move the part, but only to the point of the mouse, which will always be somewhere on the part, given I have to select the part. Guess Im asking someone to explain a drag tool to me. TargetFilter prevent all selection of said parts, so Im not sure how that could be the answer, but I did try it and results were as expected. :( But thanks.
Report Abuse
GhostOfAKing is not online. GhostOfAKing
Joined: 25 Apr 2015
Total Posts: 32
04 Feb 2017 07:53 AM
@IVgormYT

I meant in game. I want to be able to drag models in games.😢
Report Abuse
Disillusions is not online. Disillusions
Joined: 10 Jul 2011
Total Posts: 6365
04 Feb 2017 07:53 AM
what do you mean about target filter?


Report Abuse
GhostOfAKing is not online. GhostOfAKing
Joined: 25 Apr 2015
Total Posts: 32
04 Feb 2017 08:05 AM
It ignores any brick set within it, I misread your first reply.
Report Abuse
Gomlsauresrex is not online. Gomlsauresrex
Joined: 25 Mar 2016
Total Posts: 3588
04 Feb 2017 08:05 AM
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local uis = game:GetService("UserInputService")

uis.InputChanged:connect(function(input, event)
if event then return end
if input.UserInputType == Enum.UserInputType.MouseMovement then
print(mouse.Hit.p)
script.Parent:SetPrimaryPartCFrame(CFrame.new(mouse.Hit.p)
end
end
Report Abuse
Gomlsauresrex is not online. Gomlsauresrex
Joined: 25 Mar 2016
Total Posts: 3588
04 Feb 2017 08:06 AM
script.Parent:SetPrimaryPartCFrame(CFrame.new(mouse.Hit.p)) *
Report Abuse
GhostOfAKing is not online. GhostOfAKing
Joined: 25 Apr 2015
Total Posts: 32
04 Feb 2017 08:21 AM
That script didn't work, I placed it in a local script within starter player scripts. Thanks though. The most important thing I value is understanding how this can be accomplished. Can you explain to me in detail how this script was meant to work. I understand most of it honestly, but I'm very loosely farmiliar with the UIS. If you'd be so kind to give me just a bit of in sight on this, I'd be very greatful. 🙏🙏🙏🙏🙏🙏




Report Abuse
GhostOfAKing is not online. GhostOfAKing
Joined: 25 Apr 2015
Total Posts: 32
04 Feb 2017 08:31 AM
Bump
Report Abuse
GhostOfAKing is not online. GhostOfAKing
Joined: 25 Apr 2015
Total Posts: 32
04 Feb 2017 08:56 AM
Bump two.



Im not even sure what bumps are suppose to do, but Ive seen people use them when their post haven't been answered.
Report Abuse
Disillusions is not online. Disillusions
Joined: 10 Jul 2011
Total Posts: 6365
04 Feb 2017 08:58 AM
basically moves the thread to the top of the page


Report Abuse
VVired is not online. VVired
Joined: 26 May 2014
Total Posts: 590
04 Feb 2017 08:59 AM
^^ they bump the thread to the top so people can see them.
Report Abuse
GhostOfAKing is not online. GhostOfAKing
Joined: 25 Apr 2015
Total Posts: 32
04 Feb 2017 09:14 AM
Oh, thanks for informing! So, can I get a little help. 😥😥😥
Report Abuse
GhostOfAKing is not online. GhostOfAKing
Joined: 25 Apr 2015
Total Posts: 32
04 Feb 2017 10:22 AM
Bump. 😥😥😥😥😥
Report Abuse
Voydex is not online. Voydex
Joined: 26 Oct 2014
Total Posts: 272
04 Feb 2017 10:26 AM
Ok so use Model:SetPrimaryPart(ARAndOMPartInThModel)

Now use Model.PrimaryPart.CFrame = game.Players.LocalPlayer:GetMouse().Target

I think that should work.
Report Abuse
GhostOfAKing is not online. GhostOfAKing
Joined: 25 Apr 2015
Total Posts: 32
04 Feb 2017 11:19 PM
That formula won't allow me to drag a part or model, but it will teleport that model to the location of the object I clicked. But thanks.

Bump.
Report Abuse
GhostOfAKing is not online. GhostOfAKing
Joined: 25 Apr 2015
Total Posts: 32
04 Feb 2017 11:56 PM
Bump. 😟😟😟😲😲😲😵😵😵😭😭😭😭😭😭😭😭😭
Report Abuse
GhostOfAKing is not online. GhostOfAKing
Joined: 25 Apr 2015
Total Posts: 32
05 Feb 2017 06:17 AM
Bump. 😥😥😥
Report Abuse
Exus100 is not online. Exus100
Joined: 11 Aug 2007
Total Posts: 351
05 Feb 2017 06:25 AM
that one guys script was meant to be placed inside a part, not playerscripts.


Report Abuse
Exus100 is not online. Exus100
Joined: 11 Aug 2007
Total Posts: 351
05 Feb 2017 06:40 AM
local UserInputService = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local mouseDown = true
local selected = nil
local selectableModel = workspace:WaitForChild("MyModel")

UserInputService.InputChanged:connect(function(input, event)

if input.UserInputType ==##num.UserInputType.MouseMovement then
if (selected ~= nil) then
if (selected.PrimaryPart ~= nil) then
local mouseRay = Ray.new(mouse.UnitRay.Origin, mouse.UnitRay.Direction * 200)
local part, hit = workspace:FindPartOnRayWithIgnoreList(mouseRay, {selected})

selected:SetPrimaryPartCFrame(CFrame.new(hit))
else
print("No primary part set!")
end
else
print("Nothing selected!")
end
end
end)


UserInputService.InputBegan:connect(function(input, event)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
mouseDown = true
if (mouse.Target ~= nil and mouse.Target:IsDescendantOf(selectableModel)) then
selected = selectableModel
end
end
end)

UserInputService.InputEnded:connect(function(input, event)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
mouseDown = false
selected = nil
end
end)


Report Abuse
Exus100 is not online. Exus100
Joined: 11 Aug 2007
Total Posts: 351
05 Feb 2017 06:41 AM
pastebin
YpB3P6n4


Report Abuse
Naco88 is not online. Naco88
Joined: 30 Oct 2009
Total Posts: 665
05 Feb 2017 07:00 AM
Use mouse.Target



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