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

How do I make my whole script run everything together at the same time and not one after one?

I am trying to make it all run together at the same time and not code after code.. I am just a beginner so sorry for any stupid question... I really do apologize. Also a side note please don't give me any advanced syntax or anything that is more advanced... I only learnt the basics so far and would love to see this go as basic as possible.

I'm trying make it so it will print the for value every second while the brick is changing color at the same time and when the for value reaches 20 it will delete the PPart which is the part that changes colors. also there is another two new parts spawned which is "SpawningCubes" and the "Axi" which I want to run at the same time... basically I want all the code run everything at the same time.. how do I do that? Also there is a problem once it counts to 20 it stops the whole script for some reason.

-- Variables

SpawnL = Instance.new("SpawnLocation")
SpawnL.Size = Vector3.new(17.74, 1, 15.86)
SpawnL.Position = Vector3.new(-79.133, 340.231, 43.83)
SpawnL.Anchored = true
SpawnL.BrickColor = BrickColor.new("Bright blue")
SpawnL.Material = "Foil"
SpawnL.Parent = game.Workspace
while true do

PPart = game.Workspace.Part
function Disco(COL1,COL2,COL3,COL4,COL5,COL6)
	for DiscoLimit = 1,20,1 do
	
	print(DiscoLimit)
wait(0.3)

if DiscoLimit == 20 then
	game.Workspace.Part:Destroy()
end
end
	PPart.BrickColor = BrickColor.new(COL1)
	wait(2)
	PPart.BrickColor = BrickColor.new(COL2)
	wait(2)
	PPart.BrickColor = BrickColor.new(COL3)
	wait(2)
	PPart.BrickColor = BrickColor.new(COL4)
	wait(2)
	PPart.BrickColor = BrickColor.new(COL5)
	wait(2)
	PPart.BrickColor = BrickColor.new(COL6)
	
end
	
	Disco("Royal purple","Bright blue","Bright red","New Yeller","Really black","Really red")

end


-- Platform to spawn cubes on
SpawningCubes = Instance.new("Part")
SpawningCubes.Size = Vector3.new(17.74, 1, 15.86)
SpawningCubes.Position = Vector3.new(-39.04, 340.231, 43.83)
SpawningCubes.Anchored = true
SpawningCubes.CanCollide = true
SpawningCubes.BrickColor = BrickColor.new("Really red")
SpawningCubes.Material = "Grass"

SpawningCubes.Parent = game.Workspace

wait(1)


for axi = 1,20,1 do
	
wait(1)
if axi>0 then
	print(axi)
	Test = Instance.new("Part")
Test.Size = Vector3.new(1.63, 1.66, 1.76)
Test.Position = Vector3.new(-36.546, 344.371, 44.08)
Test.Anchored = false
Test.CanCollide = true
Test.BrickColor = BrickColor.new("Royal purple")
Test.Material = "Sand"

Test.Parent = game.Workspace
wait(1)
end
end








2 comments

0

What exactly do you need to run at the same time in this script? You can use spawn() function to run a function at the same time as others. Also using wait() will obviously take the function some time to finish.

0

I want the whole script to run everything at the same time... for example that it will change the brickcolors and also print the for value... basically lines 1-40 I want them to run together at the same time... and then when they finish move on to lines 41-72.

1 answer

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