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: Clone/Copy Tool

Previous Thread :: Next Thread 
MrNicNac is not online. MrNicNac
Joined: 29 Aug 2008
Total Posts: 26567
30 Oct 2013 09:34 AM
Alright, so this is some hardcore stuff right here.

I've recreated the clone/copy tool. Simple, easy. Whatever. Though I'm not 100% sure how to replicate the feature that automatically places it world-space above the part it's clone on (and then doing the same for any parts that sit on top of those).

So yeah, is there some simple method of doing it, or what?
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
30 Oct 2013 09:38 AM
For world space, wouldn't you just set clone.Position = orig.Position and then let Roblox automatically move the part up?
Report Abuse
MrNicNac is not online. MrNicNac
Joined: 29 Aug 2008
Total Posts: 26567
30 Oct 2013 09:39 AM
It explodes.
Report Abuse
VictorProjects is not online. VictorProjects
Joined: 07 Mar 2010
Total Posts: 4137
30 Oct 2013 10:01 AM
Add a Vector3 to the original position upon cloning.
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
30 Oct 2013 10:02 AM
MoveTo?
Report Abuse
MrNicNac is not online. MrNicNac
Joined: 29 Aug 2008
Total Posts: 26567
30 Oct 2013 10:03 AM
On a brick?
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
30 Oct 2013 10:03 AM
...How does a brick explode?
Report Abuse
VictorProjects is not online. VictorProjects
Joined: 07 Mar 2010
Total Posts: 4137
30 Oct 2013 10:07 AM
Through the power of exaggeration.
Report Abuse
uyjulian is not online. uyjulian
Joined: 29 Nov 2012
Total Posts: 1214
30 Oct 2013 10:08 AM
anchor it, remove all the velocity, then move, the unanchor.
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
30 Oct 2013 10:09 AM
It could be Instnace.new('Explosion',workspace).Position=part.Position, but I doubt that.
Report Abuse
MrNicNac is not online. MrNicNac
Joined: 29 Aug 2008
Total Posts: 26567
30 Oct 2013 10:09 AM
I ended up having to use this cheap-o way of finding which side is pointing highest in the Y direction and then placing it relative to that. It works amazingly. Here's the bin-script:

wait(2)
local p = Game['Players']['LocalPlayer']
local d = Instance.new([=====]Dragger]=====])
local isDrag = ((((((((((not not not true))))))))));

script.Parent.Selected:connect(function(mouse)
mouse.Button1Down:connect(function()
local t = mouse['Target'];
if not p['Dock']['Value'] then return end
if t then
if p.BrickCount.Value > (((((((((99)))))))) then return end
if t.Name:match("Build_Part") and t:IsDescendantOf(p.Dock.Value) then
local highest = GetSidePointingUp(t);
local spacing = nil;
if highest.enum == [=================[Top]=================] or highest.enum == [===[Bottom]===] then
spacing = t.Size.Y
elseif highest.enum == "Left" or highest.enum == "Right" then
spacing = t['Size']X;
else
spacing = t.Size.Z
end
print(highest.enum);
local part = t:Clone()
part.Parent = p.Dock.Value
part.Position = t.Position + (t.CFrame:vectorToWorldSpace(Vector3.FromNormalId(Enum.NormalId[highest.enum])) *spacing)
part.Name = p.Name .. "_Build_Part"
p.BrickCount.Value = p.BrickCount.['Value'] + (((1)))

pcall(function()
d:MouseDown(part, part['Position'] - mouse.Hit.p, ({part}));
--d:MouseMove(t.Position.unit);
end)
isDrag = true;
end
end
end)
mouse.Button1Up:connect(function()
pcall(function()
d:MouseUp();
end)
isDrag = false
end)
mouse.KeyDown:connect(function(k)
if isDrag then
if k == "r" then
d:AxisRotate(Enum.Axis.Z);
elseif k == "t" then
d:AxisRotate(Enum.Axis.Y);
end
end
end)
mouse.Move:connect(function()
local t = mouse.Target
if t then
if t.Name:match("Build_Part") and t:IsDescendantOf(p.Dock.Value) then
mouse.Icon = "rbxasset://textures\\CloneOverCursor.png";
else
mouse.Icon = "rbxasset://textures\\CloneCursor.png";
end
else
mouse.Icon = "rbxasset://textures\\CloneCursor.png";
end
if isDrag then
pcall(function()
d:MouseMove(mouse.UnitRay);
end)
end
end)
end)

function GetSidePointingUp(part)
local lookVector = part.CFrame.lookVector
local backVector = part.CFrame.lookVector * -1
local rightVector = part.CFrame:vectorToWorldSpace( Vector3.new(1,0,0) )
local leftVector = part.CFrame:vectorToWorldSpace( Vector3.new(-1,0,0) )
local upVector = part.CFrame:vectorToWorldSpace( Vector3.new(0,1,0) )
local downVector = part.CFrame:vectorToWorldSpace( Vector3.new(0,-1,0) )
local highest = {val=-1e10, enum=nil};
if lookVector.Y > highest.val then
highest.val = lookVector.Y
highest.enum = "Front"
end
if backVector.Y > highest.val then
highest.val = backVector.Y
highest.enum = "Back"
end
if rightVector.Y > highest.val then
highest.val = rightVector.Y
highest.enum = "Right"
end
if leftVector.Y > highest.val then
highest.val = leftVector.Y
highest.enum = "Left"
end
if upVector.Y > highest.val then
highest.val = upVector.Y
highest.enum = "Top"
end
if downVector.Y > highest.val then
highest.val = downVector.Y
highest.enum = "Bottom"
end
return highest
end
Report Abuse
VictorProjects is not online. VictorProjects
Joined: 07 Mar 2010
Total Posts: 4137
30 Oct 2013 10:11 AM
Question; This is neat and all, but why reinvent the wheel here?
Report Abuse
MrNicNac is not online. MrNicNac
Joined: 29 Aug 2008
Total Posts: 26567
30 Oct 2013 10:12 AM
@Victor

Look at how it works a bit. I have to use it for a custom-based building game.
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
30 Oct 2013 10:12 AM
[=====]Dragger]=====]

...Whats with this?
Report Abuse
MrNicNac is not online. MrNicNac
Joined: 29 Aug 2008
Total Posts: 26567
30 Oct 2013 10:13 AM
An error in my script.
Report Abuse
ThePC8110 is not online. ThePC8110
Joined: 04 Jun 2011
Total Posts: 486
30 Oct 2013 10:24 AM
Use position. It'll make it appear on top and then you simply anchor it to avoid explosion?
An alternative would be Workspace.findPartsInRegion3 with a loop to get the last part in the line and make one on top of it.
Report Abuse
woot3 is not online. woot3
Joined: 10 Nov 2008
Total Posts: 3599
30 Oct 2013 11:44 AM
I'm pretty sure I did this once and it's much easier than you're making it out to be.

Part:Clone()
Part.Parent = game.Workspace
Part.Position = PrevPart.Position
Part:MakeJoints()

Report Abuse
AbsoluteLOL is not online. AbsoluteLOL
Joined: 01 Dec 2012
Total Posts: 3939
30 Oct 2013 02:08 PM
"((((((((((not not not true))))))))));"
I cried.
Report Abuse
soupsoupsoup3 is not online. soupsoupsoup3
Joined: 31 Jul 2013
Total Posts: 219
30 Oct 2013 03:44 PM
"((((((((((not not not true))))))))));"
I died X_x
Report Abuse
Samacado is not online. Samacado
Joined: 16 Feb 2008
Total Posts: 25119
30 Oct 2013 05:27 PM
make joints.
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
30 Oct 2013 06:04 PM
Maybe I misread or something but
NewPart.Position = Vector3.new(OldPart.Positon.X,OldPart.Positon.Y+OldPart.Size.Y,OldPart.Positon.Z)

Otherwise be a bit more specific please.
Report Abuse
BIunt is not online. BIunt
Joined: 28 Apr 2013
Total Posts: 88
30 Oct 2013 10:01 PM
Lol be specific...
Report Abuse
UgOsMiLy is not online. UgOsMiLy
Joined: 15 Sep 2009
Total Posts: 2095
31 Oct 2013 04:12 AM
maybe something like part.Position = clonedpart.Position, and because no bricks can go through other ones, it'll move it up, i'm not very sure
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