Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Make a Tycoon Dropper drop models?

I wanted to know if i could create a tycoon dropper and make it drop a model? i built a model and i wanted to drop it, like it could be in server storage and it would be cloned?

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

while true do
	wait(2.5) -- How long in between drops
	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 = 10 -- How much the drops are worth
	part.CFrame = script.Parent.Drop.CFrame - Vector3.new(0,1.6,0)
	part.FormFactor = "Custom"
	part.Size=Vector3.new(1.4, 1.4, 1.4) -- Size of the drops
	part.TopSurface = "Smooth"
	part.BottomSurface = "Smooth"
	game.Debris:AddItem(part,20) -- How long until the drops expire
end

2 comments

0

Use a weld script inside the model and clone the model from that script example: game.ServerStorage.MODELNAME:clone etc...

0

I'm pretty new, do you think you could show me where i'd add it, and stuff?

1 answer

First you model needs to be welded. Depending on your model's complexity you can do this manually or you may want to do it with a script.

-- Weld script by crazyman32
-- This goes in a script, the script goes in model. 

--IMPORTANT: If your model is in ServerStorage or ReplicatedStorage you need to pre-weld the model. 

function weld()
	local parts,last = {}
	local function scan(parent)
		for _,v in pairs(parent:GetChildren()) do
			if (v:IsA("BasePart")) then
				if (last) then
					local w = Instance.new("Weld")
					w.Name = ("%s_Weld"):format(v.Name)
					w.Part0,w.Part1 = last,v
					w.C0 = last.CFrame:inverse()
					w.C1 = v.CFrame:inverse()
					w.Parent = last
				end
				last = v
				table.insert(parts,v)
			end
			scan(v)
		end
	end
	scan(script.Parent)
	for _,v in pairs(parts) do
		v.Anchored = false
	end
end

weld()
script:Remove()

After you've welded your model, Set the primary part of you model. The primary part should probably be in the center top of your model.

Now simply clone the model, set parent, then use set the primary parts CFrame to the drop CFrame.

You can use the wiki to learn about everything in this answer. This wiki link will help with a lot of what you'll need. API:Class/Model

3 comments

0

I'll leave the rest up to you.

0

For a dropper, I would think for the primary part, it would be best to use the head. :P

0

iiEffects made no mention of a head.

This discussion is preserved as it was. New answers, comments, and votes are closed.