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

how can i make a dropper drop a roblox model not just a block?

Asked by
techan0 -12
7 years ago
Edited 7 years ago

here is the code im using i just need it to drop a model (to be exact the model i want is https://web.roblox.com/library/22097287/MicroChip ) in roblox other then just a block.

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


deb = true 
script.Parent.Clicker.ClickDetector.MouseClick:connect(function(wat)
    if deb == true then
        deb = false
            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 = 1 -- How much the drops are worth
            part.CFrame = script.Parent.Drop.CFrame - Vector3.new(0,1.3,0)
            part.FormFactor = "Custom"
            part.Size=Vector3.new(1, 1, 1) -- Size of the drops
            part.TopSurface = "Smooth"
            part.BottomSurface = "Smooth"
            game.Debris:AddItem(part,20) -- How long until the drops expire
            wait(.15)
            deb = true
    end
end)

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

I would recommend putting the model you've made into game.ServerStorage, when you want to use it use the follow code.

local ServerStorage = game.ServerStorage -- Serverstorage
local model = ServerStorage.Model -- Replace with modelname


script.Parent.MouseClick:connect(function()
    local DropClone = model:Clone() -- Clones model
    local Worth = Instance.new("NumberValue", model)-- How much the model is worth.
    Worth.Name = "Worth"
    Worth.Value = 200
    DropClone.Name = "DropC" -- Names model
    DropClone.Parent = workspace -- Puts model in workspace
    DropClone:MoveTo(workspace.Dropper.Position) -- Dropper
end)



-- Endpart

script.Parent.Touched:connect(function(hit)
    local a = hit.Parent:FindFirstChild("Worth")
    hit.Parent:remove()
    -- Now you just gotta add a.Value to your money
end)








If it doesn't work or if you do have questions please ask em!

~ Arthenix

0
how would i add the price for each drop when it makes it to the end? techan0 -12 — 7y
0
Made a endpart script. DjinoKip 78 — 7y
Ad

Answer this question