Cloning A Part To A GUI

The part is not being cloned, I don’t know if the camera’s even being made. Here’s the local script:

local player = game.Players.LocalPlayer
local MainGUI = player.PlayerGui:WaitForChild("MainParticlesGUI")
local MainFrame = MainGUI.MainFrame
local ReplicatedStroage = game:GetService("ReplicatedStorage")
local ConfettiCode = script.Parent
local ViewportFrame = ConfettiCode.ViewportFrame1
local ViewportCamera = Instance.new("Camera")

local StarFetti = ReplicatedStroage:WaitForChild("StarFetti")



if ViewportFrame:IsA("ViewportFrame") then
	if ViewportFrame ~= nil then
		local FettiClone = StarFetti:Clone()
		task.wait(3)
		if FettiClone ~= nil then
			FettiClone.Parent = ViewportFrame
			ViewportFrame.CurrentCamera = ViewportCamera
			ViewportCamera.Parent = ViewportFrame
			ViewportCamera.CFrame = CFrame.lookAt(FettiClone.Position + Vector3.new(0, 4, 0), FettiClone.Position)
			print("Cloned")
		end
	end	
end	

You made the look at, the positions are still wrong tho…

1 Like

Try this instead

viewportCamera.CFrame = CFrame.new(Vector3.new(0, 2, 12), FettiClone.Position)
2 Likes

No luck, guess I got to make my custom particles.

So weird how you can’t clone a part to a GUI but can’t do nothing about it.

You can’t do particles in viewportframe But there is a module that makes particle on the gui.

Here it is

1 Like

I’ve been trying to use that all along but it’s frustrating.

You can, you never made it correctly (sorry i was gone ;-; )

Camera.CFrame = part.CFrame * CFrame.new(0 , 4 , 0) --feel free to change the numbers
Camera.CFrame = CFrame.LookAt(part.position , part.position)
1 Like

I managed to make my own custom particles but thanks man! Also, I need help with something.

nice, fell free to ask anything you want!

1 Like

I am trying to add a kind of delay to the frames that I have in a table. Basically, I have 3 frames inside of one whole frame and I did a for loop in order to access these frames but I want to make a kind of delay between them so like for instance, Frame 1 is found in the table and particles shoot out of that but there is a .5 second delay before particles shoot out in Frame 2 and so on.

1 Like

Basically something like switches, so I clone a script to the the three frames but I want the cloned script parented to Frame 2 to activate a little later than the cloned script parented to Frame 1.

1 Like

is it working fine? if yes then great if not I can help!

Yeah I need help adding in the delay that I was explaining.

im kinda dumb so sry about that, show me your current code

This is pretty much the code in a local script:

local ServiceRun = game:GetService("RunService")
local MainFrame = script.Parent:WaitForChild("MainFrame")

local FettiModule = require(script.StarFettiModuleScript)
FettiModule.SetGravity(Vector2.new(0.1, 0.5))

local StarFetti = {}


local StarFettiAmount = 70
for _, Frames in ipairs(MainFrame:GetChildren()) do
	if Frames ~= nil then
		if Frames:IsA("Frame") then
			ScriptClone = script:Clone()

			print(Frames)

			for i=1, StarFettiAmount do
				local StarFettiProperties = FettiModule.CreateParticle(
					Vector2.new(0.01, 0.10),
					Vector2.new(math.random(60)-30, math.random(15,45)),
					Frames,
					{Color3.fromRGB(255, 0, 0), Color3.fromRGB(255, 85, 0), Color3.fromRGB(255, 255, 0), Color3.fromRGB(0, 255, 0), Color3.fromRGB(0, 255, 255), Color3.fromRGB(0, 0, 255), Color3.fromRGB(170, 0, 255)}
				)
				table.insert(StarFetti, StarFettiProperties)
			end
		end
	end
end


local StarFettiColors = {Color3.fromRGB(255, 0, 0), Color3.fromRGB(255, 85, 0), Color3.fromRGB(255, 255, 0), Color3.fromRGB(0, 255, 0), Color3.fromRGB(0, 255, 255), Color3.fromRGB(0, 0, 255), Color3.fromRGB(170, 0, 255)}
local StarFettiActive = false
local count = 0

ServiceRun.RenderStepped:Connect(function()
	for _, Particles in pairs(StarFetti) do
		if (StarFettiColors) then
			Particles:SetColors(StarFettiColors)
		end
		Particles.Enabled = StarFettiActive
		Particles:Update()
	end
end)


local ParticlesFire = function(StarFettiStarColors)
	StarFettiColors = StarFettiStarColors
	spawn(function()
		StarFettiActive = true
		if tonumber(count) == 3 then
			wait(os.time)
			StarFettiActive = false	
			count = 0
			print(count, "Count Refrsshed")
		end
	end)
end



while wait(2) do
	print("Fired")
	ParticlesFire(StarFettiColors)
	count = count + 1
	print(count)
end

If you need the module script, I will send it and here’s a screenshot of how everything is setup:
Screenshot (1)

1 Like

where do you exactly need the delay? the for loop at the start?

I may need it at the spawn function or by the for loop. I tried at the for loop but it didn’t work out so I’m a bit stuck.

1 Like