Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

3 comments

0

That is possible to do, but may be impossible for people that are beginners.

0

This isn't a request site.

0

Im not requesting

1 answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.