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
 

Editing a drag part script

Previous Thread :: Next Thread 
BlockBob12 is not online. BlockBob12
Joined: 05 Apr 2012
Total Posts: 172
22 Jan 2017 06:02 AM
This script works really weel but it only works on one part in the game, If there's more than one part the script selects one part and works well with it. I want this to work with all parts that are called Part.
Copy this script into a LocalScript and put it into StarterPlayer.StarterPlayerScripts


local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local part = workspace.Part
local target

mouse.Move:connect(function()
if target then
mouse.TargetFilter = target
target.Position = mouse.Hit.p+Vector3.new(0,1,0)
--CFraming with negate the anchoring so it will be frozen where you leave it
end
end)

mouse.Button1Down:connect(function()
if mouse.Target and mouse.Target == part then
target = part
target.Anchored = true
end
end)

mouse.Button1Up:connect(function()
mouse.TargetFilter = nil
if target then
target.Anchored = false
target = nil
end
end)
Report Abuse
KritikalGunzz is not online. KritikalGunzz
Joined: 10 Nov 2013
Total Posts: 1633
22 Jan 2017 07:12 AM
Rename all the parts you want draggable to something else, and check the name of the part is what you chose.
Report Abuse
UltimateRaheem is not online. UltimateRaheem
Joined: 10 Nov 2012
Total Posts: 1886
22 Jan 2017 07:40 AM
You could create a model which all of the parts in workspace named 'Part' will be inside of. And then you can use the :GetChildren() function to move all of the parts.

Or, you can store every part in the game into a table and use the pairs loop to move the parts.


Want to be supported by developers in a positive atmosphere? Then join Studio BSD: https://www.roblox.com/My/Groups.aspx?gid=1013064
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