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

Is there a way I can make my dropper script shorter?

Asked by
i_Rook 18
4 years ago
Edited 4 years ago

Hey! I was just wondering if I can make this script I wrote, more simple?

01x = 1
02y = 1
03z = 1
04 
05function drop()
06    local Dropped = Instance.new("Part")
07    Dropped.Position = script.Parent.Position
08    Dropped.Size = Vector3.new(x, y , z)
09    Dropped.BrickColor = BrickColor.new("Beige")
10    Dropped.TopSurface = "Smooth"
11    Dropped.BottomSurface = "Smooth"
12    Dropped.Name = "Block"
13    Dropped.Parent = script.Parent
14    Dropped.Massless = true
15    Dropped.Anchored = false
View all 21 lines...

Thanks!

0
Is there any reason to make it shorter? just asking marine5575 359 — 4y
2
for the varibles at the top try this: x, y, z = 1, 1, 1 marine5575 359 — 4y

1 answer

Log in to vote
2
Answered by
Is_Hunter 152
4 years ago
Edited 4 years ago

Actually, instead of instancing you can make a pre existing part and clone it.

01local dropped_sample = script.Dropped -- assuming the part is a child of the script
02 
03local function drop()
04    local dropped = dropped_sample:Clone()
05        dropped.Parent = script.Parent
06end
07 
08while wait(3) do
09    drop()
10end
1
and it is probably more performance wise better too 123nabilben123 499 — 4y
Ad

Answer this question