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

How do I make it so that the second part will do the same thing as the first part in this for loop?

        local offset = CFrame.new(0,0,10)
		local point = CFrame.new(plr.Character.HumanoidRootPart.CFrame.lookVector)	
		
		local  F1 =	game.ReplicatedStorage.F1:Clone()
		local F2= game.ReplicatedStorage.F2:Clone()
	    F2.Parent = game.Workspace
		F1.Parent = game.Workspace
		
			
		
		while  true do
			
			local point = CFrame.new(plr.Character.HumanoidRootPart.Position)
			
			
			for i = 1,360 do
				
				F1.CFrame = point * CFrame.Angles(0,math.rad(i),0) * offset			
								
				wait()							
			end
			

For this specific part in my script Im having troubles. Now F1 is the first ball that circles the player. It works just fine, it goes around the player just how I want it. But I dont know how to do that for F2. I want a wait of 1 second before it starts to rotate as well so it isnt inside the first ball. When I add a wait inside the for loop it messes up the rotation and still has the second ball inside the first, could someone explain how I would make the second ball (F2) go around the player as well but wait 1 second?

1 answer

✓ Accepted answer
local offset = CFrame.new(0,0,10)
local point = CFrame.new(plr.Character.HumanoidRootPart.CFrame.lookVector)  

local  F1 = game.ReplicatedStorage.F1:Clone()
local F2= game.ReplicatedStorage.F2:Clone()
F2.Parent = game.Workspace
F1.Parent = game.Workspace



while  true do
	local point = CFrame.new(plr.Character.HumanoidRootPart.Position)

    spawn(function()
		for i = 1,360 do
			F1.CFrame = point * CFrame.Angles(0,math.rad(i),0) * offset         
			wait()                          
		end
    end)

	wait(1)
	
    for i = 1,360 do
		F2.CFrame = point * CFrame.Angles(0,math.rad(i),0) * offset         
		wait()                          
    end
end

1 comment

0

Please explain your answer.

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