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

How To Make Droppers To Drop Models ?

Asked by 7 years ago
Edited 7 years ago

I'm using this script. How Can I Make It Drop "173751374" Model?

wait(2)
workspace:WaitForChild("PartStorage")

while true do
    wait(1) 
    local part = Instance.new("Part",workspace.PartStorage)
    part.BrickColor=script.Parent.Parent.Parent.DropColor.Value
    part.Material=script.Parent.Parent.Parent.MaterialValue.Value
    local cash = Instance.new("IntValue",part)
    cash.Name = "Cash"
    cash.Value = 5
    part.CFrame = script.Parent.Drop.CFrame - Vector3.new(0,1.4,0)
    part.FormFactor = "Custom"
    part.Size=Vector3.new(1.2, 1.2, 1.2)
    part.TopSurface = "Smooth"
    part.BottomSurface = "Smooth"
    game.Debris:AddItem(part,20)
end

1 answer

Log in to vote
0
Answered by 7 years ago

Well, there's many methods to do what you're asking. I'll just go over the 3 easiest and most common methods. c;

Method 1: C L O N I N G!

Kinda like Dolly the sheep-- but in roblox. If you take the model you wish to insert and put it into the ServerStorage/ReplicatedStorage/ReplicatedFirst/Area-you’re-taking-the item-from-in-general you can clone the model with the clone() function.

clone() lets you copy objects that already exist in the place or ones generated by scripts.

wait(2)
local PartStorage = game.workspace:WaitForChild("PartStorage")-- It's exactly 12,000 times easier to just make this a variable
local Dollar = game.ServerStorage:WaitForChild("NameOfTheModelHere") -- Placed outside the script because whats the use of always pointing to the same place?

while true do
    wait(1) 
    local Part = Dollar:clone() 
    Part.Parent = PartStorage   
    local cash = Instance.new("IntValue",Part)
    cash.Name = "Cash"
    cash.Value = 5
    Part.CFrame = script.Parent.Drop.CFrame - Vector3.new(0,1.4,0)
    game.Debris:AddItem(Part,20)
end

Method 2: LoadAsset

LoadAsset() is a function of the abstract class InsertService and can be used to insert models that are either owned by you or the official Roblox account. Please note that items inserted this way are also put into a model before being inserted into your place and common virus scripts are deleted from it.

wait(2)
local PartStorage = game.workspace:WaitForChild("PartStorage")


while true do
    Item = game:GetService("InsertService"):LoadAsset(173751374) -- Placed it in the loop so it reloads the model instead of toying with ones already inserted
    wait(1) 
    Item.Parent = workspace
    local cash = Instance.new("IntValue",Item)
    cash.Name = "Cash"
    cash.Value = 5
    Item.Union.CFrame = script.Parent.Drop.CFrame - Vector3.new(0,1.4,0)
    Item.Union.Anchored = false -- The model was anchored 
    game.Debris:AddItem(Item,20)
end

Please note that this thing can error alot depending on the situation and if this errors it’ll /probably/ /completely/ break your script. For information about handling InsertService errors go here: <http://wiki.roblox.com/index.php?title=API:Class/InsertService/LoadAsset >

Method 3: Making it from s c r a t c h

You can also just have the script generate the robuck from scratch. Or at least a part that looks like the robuck you want to insert. It’s a bit tedious to type but it’s the most reliable method for your end goal in my opinion.

wait(2)
local PartStorage = game.workspace:WaitForChild("PartStorage")-- It's exactly 12,000 times easier to just make this a variable


while true do
    wait(1) 
    local Part = Instance.new("Part", PartStorage)
    Part.Size = Vector3.new(2, 0.2, 1)
    Part.BrickColor = BrickColor.new("Bright green")
    Part.BottomSurface = "Smooth"
    Part.TopSurface = "Smooth"

    local Decal = Instance.new("Decal", Part)
    Decal.Texture = "rbxassetid://49810468"
    Decal.Face = "Top"

    local cash = Instance.new("IntValue",Part)
    cash.Name = "Cash"
    cash.Value = 5
    Part.CFrame = script.Parent.Drop.CFrame - Vector3.new(0,1.4,0)
    game.Debris:AddItem(Part,20)
end

I hoped this helps!! A L S O actually read what I'm telling you-- you'll learn yourself a thing or two!

OK back to whatever I was doing before.

0
Hello, im too making tycoon with droppers that will drop models. I have used your CLONING method but the model dont want to sell.. what i have to do to make it sell? DJ_cebula 0 — 4y
Ad

Answer this question