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")
local Dollar = game.ServerStorage:WaitForChild("NameOfTheModelHere")
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)
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
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")
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.
1 comment
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?