Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Allow objects to be dragged in-game with mouse?

Asked by 5 years ago
Edited 5 years ago

I know this is not a request site, but I cannot find anything about this topic online that fits my needs.

I am in need of a system/script that allows when a player clicks (holds) an object, they can drag the object around, like in Lumber Tycoon 2. All I need is a way for players to hold click on an object and drag it around (nothing else). Again, I tried looking online but only find ways to move objects with only the x-axis and not the y-axis. I do not need scripts, just need to be pointed in the right direction. Thank you in advance.

https://scriptinghelpers.org/questions/35244/dragging-physics-like-lumber-tycoon-2

The link above does relate to my problem, I looked at the answer and do not know how to apply it and use the scripts provided.

0
its in the blog. greatneil80 2647 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

I'd suggest utilizing the .Hit property of the player's mouse with of course the user input service.

It returns the in-game Vector3 position that your mouse is ending at and you can subsequently set the Vector3 of an object to that position.

Links;

https://developer.roblox.com/en-us/api-reference/property/Mouse/Hit https://developer.roblox.com/en-us/api-reference/event/UserInputService/InputBegan

Ad

Answer this question