You should start by fixing your tabbing so that it is easy to read your code:
a = game.Workspace.Map:GetChildren()
script.Parent.Touched:connect(function()
if script.Parent.Parent.Touched.Value == 0 then
script.Parent.Parent.Touched.Value = 1
wait(25)
for index,v in pairs(a) do
for i = 1,625 do
local s = math.random(2,6)
v.Size = Vector3.new(4,s,4)
wait(.005)
end
end
end
end)
I'm not sure why you are using a IntValue when you could just be using a variable:
numberTouched = 0
...
numberTouched = 1
The minimum amount of time that wait is allowed to wait is about .034 seconds, which is 7 times slower than the amount you are trying to wait.
Your code attempts to resize each part individually 625 times, then moves onto the next part. Each part would take about a third of a minute, then.
If there are other objects in Map other than parts (e.g., Scripts, Models), though, you'll have a problem -- because they don't have a Size property.
You should check that v:IsA("BasePart") to ensure that v is in fact something that can be resized.
You should be using better variable names. a is a bad name for the list of objects in a map. Just say map or mapChildren or some other useful variable name.
3 comments
It like my things like pyramids like that.
I did what you said, but it just kept changing the the size of one block, not all 625.
You didn't read what I said then. Because I said that you have that set up wrong