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?

x = 1
y = 1
z = 1

function drop()
    local Dropped = Instance.new("Part")
    Dropped.Position = script.Parent.Position
    Dropped.Size = Vector3.new(x, y , z)
    Dropped.BrickColor = BrickColor.new("Beige") 
    Dropped.TopSurface = "Smooth"
    Dropped.BottomSurface = "Smooth"
    Dropped.Name = "Block"
    Dropped.Parent = script.Parent
    Dropped.Massless = true
    Dropped.Anchored = false
end

while true do
    wait(3)
    drop()
end

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.

local dropped_sample = script.Dropped -- assuming the part is a child of the script

local function drop()
    local dropped = dropped_sample:Clone()
        dropped.Parent = script.Parent
end

while wait(3) do
    drop()
end
1
and it is probably more performance wise better too 123nabilben123 499 — 4y
Ad

Answer this question