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

How to clone multiple quantities of the same model/part?

Asked by 4 years ago

i've been having this issue for months and i cant find any solutions, whenever i make a clone of something or just make an instance of a part, i can only spawn that one part once. i want to spawn it as much as i click/want. any help would be amazing! here is my script (its a fireball script i made, dont judge it too hard but it works.)

local fireball = Instance.new("Part")
local fire = Instance.new("Fire")
local smoke = Instance.new("Smoke")
fireball.Shape = Enum.PartType.Ball
fireball.BrickColor = BrickColor.new("Dark orange")
fireball.Size = Vector3.new(4,4,4)
fireball.Material = "Neon"
fireball.Transparency = 0.05
fire.Parent = fireball
fire.Color = Color3.new(124, 71, 36)
fire.Heat = 14
fire.Size = 12
fire.Enabled = true
smoke.Parent = fireball
smoke.Opacity = 0.5
smoke.RiseVelocity = 15
smoke.Size = 15
smoke.Enabled = true
smoke.Color = Color3.new(70,70,70)

local speed = 555
script.Parent.Activated:Connect(function()
    fireball.Parent = game.Workspace
     fireball.Position = script.Parent.Handle.Position
     fireball.Velocity = script.Parent.Handle.CFrame.LookVector * speed
end)

1 answer

Log in to vote
0
Answered by 4 years ago

You haven't cloned the fireball, so it keeps parenting the same fireball to the workspace. Example Script:

local fireball = Instance.new("Part")
local fire = Instance.new("Fire")
local smoke = Instance.new("Smoke")
fireball.Shape = Enum.PartType.Ball
fireball.BrickColor = BrickColor.new("Dark orange")
fireball.Size = Vector3.new(4,4,4)
fireball.Material = "Neon"
fireball.Transparency = 0.05
fire.Parent = fireball
fire.Color = Color3.new(124, 71, 36)
fire.Heat = 14
fire.Size = 12
fire.Enabled = true
smoke.Parent = fireball
smoke.Opacity = 0.5
smoke.RiseVelocity = 15
smoke.Size = 15
smoke.Enabled = true
smoke.Color = Color3.new(70,70,70)

local speed = 555
script.Parent.Activated:Connect(function()
    fireball = fireball:Clone() -- Create a clone of the fireball
    fireball.Parent = game.Workspace
     fireball.Position = script.Parent.Handle.Position
     fireball.Velocity = script.Parent.Handle.CFrame.LookVector * speed
end)
0
Thanks! x_Marwan 6 — 4y
Ad

Answer this question