pls help , so im trying to make my script work only 7 times and then wait for 40 seconds and after start the script again and so on.

here is my script :

local platforms = workspace.PlatformsFolder --put all the platforms in a folder
	 
	colors = { --table of colors
		    BrickColor.new("Electric blue"), --Really red
		    BrickColor.new("Really red"), --Really blue
	        BrickColor.new("Bright yellow"), --Deep orange
	        BrickColor.new("Lime green") 
		    }
while true do
			local color = colors[math.random(1,#colors)] --index the table and get a random color with math.random
			print(color)
			for i,v in pairs (platforms:GetChildren()) do --get children returns a table of the children in the platforms folder. for i,v in pairs goes through this table
				if v:IsA("BasePart") then --check if value is a base part
					if v.BrickColor == color then --if the color of the value is the same as the random color chosen then
						v.CanCollide = false
						v.Transparency = 1
					else --if not
						v.CanCollide = true
						v.Transparency = 0
					end
				end
			end
			wait(20) --wait however long in between color changes
		end

i tried to do it myself but it never worked, pls before sending me the solved problem , try it in roblox studio , pls help

3 comments

0

Seems fine to me, Did you anchor the parts? also you have it on a 20 seconds change time. Note: if you have them unanchored when the CanCollide Changes to false they fall through anything below

0

Unless they're welded somehow

0

i anchored them,this script works , what it does is it makes a random platform 1/4 to disappear every 20 sec,could u pls help me now, pls