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

How do you click and move an item in game. Like in retail tycoon? [closed]

Asked by 7 years ago

I know its possible but I cant find anywhere on the roblox wiki about it.

0
That is possible to do, but may be impossible for people that are beginners. thesit123 509 — 7y
0
This isn't a request site. TinyScripter 70 — 7y
0
Im not requesting FIreFlight1125 -12 — 7y

Closed as Not Constructive by Link150

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 7 years ago

You can't find it on the wiki because this isn't a simple thing to do. As with any scripting problem, one must break it down into smaller steps and sometimes break those steps into even smaller ones until each step is something that you can accomplish (sometimes with the help of the wiki or tutorials). In this case, some of the larger steps (that still need to be broken down into smaller ones) that you could use are:

  1. When the user mouse-button-downs, look at what they're clicking. If it's a 3D object that you want them to be able to move, record the object they've selected. (You might use a combination of UserInputService and/or the user's Mouse object. You could use raycasting with camera:ScreenPointToRay and workspace:FindPartOnRay or other Ray functions, or simply use Mouse.Target.)
  2. While the user's mouse is down, make note of where their mouse is aiming using that raycasting. Move the object if desired.
  3. When the user's mouse button goes up, stop moving the object around.

If most of this doesn't make sense, I would recommend starting smaller. A simpler problem that would get the same thing done is allowing them to click an object to select it and then click on the floor space where they want to move it. You could even use ClickDetectors for this purpose so you don't have to handle raycasting.

Ad