I want to create a tycoon like the one made by Biggranny000’s Youtube Group (that is the name of the roblox group that created the game ‘Deep Space tycoon’). I am using Zednov’s Tycoon Kit to achieve this (It’s called ‘Zed’s Tycoon Kit’ by ‘Zed_Gamer’), which is hard to tailor (or customize) to my exact needs.
However, I can’t find a proper format for listing part Parents to assign to cloned (or Instantiated) parts.
I tried assigning a variable listing all the parents leading from the Crystal Model, which is called ‘Clonable’ because I clone the parts in it below because there are some parts in this ore that are too complex to just instantiate like Corner Wedges and I am not sure if i can unite parts in scripting, but that didn’t really work. I also tried looking at the ‘Parents’ page (part parents) on the developer hub, hoping they would say what format the parent should be in, but they didn’t really say anything about that.
The drop i am attempting to clone and assign a parent to is made out of 1 cube (shaped into a rectangle) and has 8 Corner Wedges that I found in the Toolbox. This forms something of a crystal. This crystal piece has a duplicate that is slightly larger and shares the same position as the original crystal, making a crystal with a translucent glass outside and a (completely opaque) neon core. The script below is for a dropper and the ores (or crystals) it dispenses.
wait(2)
workspace:WaitForChild("PartStorage")
local Dropper = script.Parent
local Clonable = Dropper.Clonable
local CrystalGroup = Instance.new("Model")
CrystalGroup.Parent = script.Parent
CrystalGroup.Name = "Crystal"
local Crystal = Dropper.Clonable.Crystal:Clone()
Crystal.Parent = CrystalGroup
Crystal = Dropper.Crystal.Crystal
local Core = Dropper.Clonable.Core:Clone()
Core.Parent = CrystalGroup
local resetLoop = false
local part = Dropper.Crystal.Crystal
local partParent = Dropper.Crystal
if script.Parent.Parent == game.Workspace.Tycoons.Yellow.PurchasedObjects then
while true do
local cash = Instance.new("IntValue",Crystal)
print("Am I Working?")
cash.Name = "Cash"
cash.Value = 5 -- How much the drops are worth
Crystal.Anchored = true
Core.Anchored = true
Crystal.Position = Vector3.new(-0.539, 4.493, 41.146)
Core.Position = Vector3.new(-0.539, 4.493, 41.146)
Core.Orientation = Vector3.new(0, 0, 0)
Core.Transparency = 1
Crystal.CanCollide = false
Crystal.Orientation = Vector3.new(0, 0, 0)
Crystal.Transparency = 1
Core.CanCollide = false
wait(1.5) -- How long in between drops
Crystal.CanCollide = true
Crystal.Position = Vector3.new(-0.539, 4.493, 41.146)
Crystal.Transparency = 0.6
Core.CanCollide = true
Core.Position = Vector3.new(-0.539, 4.493, 41.146)
Core.Transparency = 0
Crystal.Anchored = false
Core.Anchored = false
end
end
I will almost certainly have more problems after this that involve my attempting to create a tycoon, so please expect further questions, should this first problem be solved. Thank you very much!
I’m a bit confused about what you’re asking, but I think you’re asking how to clone and move whole models?
You don’t need to clone every part individually, you can just clone the whole model at once!
And you can move whole models with SetPrimaryPartCFrame (just make sure assign a primary part to the crystal model) or with MoveTo.
Also, you can just use Dropper.Position directly instead of hardcoding numbers in there like that
local Clonable = Dropper.Cloneable
-- when you want to make a new crystal:
local crystal = Cloneable:Clone()
-- when you want to move the crystal (I'm assuming you want to move
-- it to where the dropper is)
crystal:SetPrimaryPartCFrame(Dropper.CFrame)
-- or
crystal:MoveTo(Dropper.Position)
That sounds like a good idea, except that my ore is in two pieces held together by a weld. Since these pieces are of different materials, I can’t unite them. I am asking for how to properly change the parents of my ore pieces and the group they are in with scripting, though your tip will most likely still be helpful, as my droppers have their ores in the position they will drop from because they have been moved there, but not in scripting and I might have many, many droppers.
PS: I assigned the neon core of the crystal ore as a primary part for ‘Clonable’, just in case that helps.
I’m not talking about unions, I’m talking about models (or groups as I think you are calling them?).
Maybe I’m just misunderstanding what the problem is, but calling Clone() on your Cloneable model will automatically also clone all the descendants of that model, along with all their positions and hierarchy. This includes welds.
For example if you wanted to copy 1 crystal per second and put it at the position of your dropper you’d just do something like:
local Dropper = script.Parent
local Clonable = Dropper.Clonable
while true do
local clone = Cloneable:Clone()
clone:MoveTo(Dropper.Position)
clone.Parent = workspace -- or wherever
wait(1)
end
When I can, I will try that, but I am worried that the script doesn’t like how I am defining the group’s parent. (btw. this is all to just make a proper dropper script)
Ok, I tried doing the cloning thing, but there is just the group named ‘Crystal’ and the ‘Clonable’ disappeared. (I’ll also stick with the position hardcoding)
Ok, I made updates to my script, including the ones you suggested:
wait(2)
workspace:WaitForChild("PartStorage")
local Dropper = script.Parent
local Clonable = Dropper.Clonable
--CrystalGroup.Parent = Dropper
--CrystalGroup.Name = "Crystal"
-- Crystal = Dropper.Clonable.Crystal:Clone()
--Crystal.Parent = CrystalGroup
--Crystal = Dropper.Crystal.Crystal
--local Core = Dropper.Clonable.Core:Clone()
local resetLoop = false
--local part = Dropper.Crystal.Crystal
--local partParent = Dropper.Crystal
if script.Parent.Parent.Name == "PurchasedObjects" then
while true do
local CrystalGroup = script.Parent.Clonable:Clone()
CrystalGroup.Parent = Dropper
CrystalGroup.Name = "Crystal"
local Crystal = CrystalGroup.Crystal
local Core = CrystalGroup.Core
--CrystalGroup.Parent = Dropper
local cash = Instance.new("IntValue",CrystalGroup)
print("Am I Working?")
cash.Name = "Cash"
cash.Value = 5 -- How much the drops are worth
Crystal.Anchored = true
Core.Anchored = true
Crystal.Position = Vector3.new(-0.539, 4.493, 41.146)
Core.Position = Vector3.new(-0.539, 4.493, 41.146)
Core.Orientation = Vector3.new(0, 0, 0)
Core.Transparency = 1
Crystal.CanCollide = false
Crystal.Orientation = Vector3.new(0, 0, 0)
Crystal.Transparency = 1
Core.CanCollide = false
wait(1.5) -- How long in between drops
Crystal.CanCollide = true
Crystal.Position = Vector3.new(-0.539, 4.493, 41.146)
Crystal.Transparency = 0.6
Core.CanCollide = true
Core.Position = Vector3.new(-0.539, 4.493, 41.146)
Core.Transparency = 0
Crystal.Anchored = false
Core.Anchored = false
game.Debris:AddItem(CrystalGroup, 20)
end
end
The crystal ores are finally properly spawning repeatedly. I would like to know if i can fit a touch detection for if the ore touches the part collecter at the end of the conveyor inside the dropper script. I don’t want it to be in one of the main scripts that control all the tycoons because there will probably be lots of droppers spawning ores and it might be too much to handle. Any tips on how I can do that?