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

Make block destroyable and after its destroys drops an item?

Asked by 6 years ago

How would i go about making a block drop an item, for example if you break a tree it drops logs and rocks drop minerals etc etc.

thanks in advance, Benmz41998

1 answer

Log in to vote
0
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
6 years ago
Edited 6 years ago

You can clone the "drop" item near the location of the "dropper".

e.g.

local drop = game.ReplicatedStorage.WoodDrop
local r = math.random --To shorten the code

--something happens
local d = drop:Clone(); --Clone item
local origin; --Define cframe of area to clone
local offset = CFrame.new(r(-5,5),5,r(-5,5)); --Define offset
d.CFrame = origin * offset;
d.Parent = workspace;
1
EYYYYYYYY ITS GOULSTEM greatneil80 2647 — 6y
Ad

Answer this question