✓ Accepted answer
Hello there! There are some definite logic issues with your script, but that is why you are here. I hope to help you with my answer. The first issue is that you are using the variable Next when it is not defined in the script. Now I know you have:
local Part = game.Workspace.Next
but that is naming the variable Part, not Next. The next issue is that your code will execute once which means that only one brick would turn red if your script worked correctly. The way to fix this problem is a loop. There is one issue I have with the approach you are using. How will the script know when to stop? One simple fix I can think of would be to have a model in workspace with all the parts you want changed in it(I will name it tower). Here is an example of what you can do:
local tower = game.Workspace.Tower
local amountOfParts = #tower:GetChildren()
for i = 1, amountOfParts do
local part = tower:FindFirstChild(tostring(i))
if part and part:IsA("BasePart") then
part.BrickColor = BrickColor.new("Really red")
end
end
I hope this helps and makes sense. Have a great day scripting!
Note: If you have any comments or questions feel free to post them below.
2 comments
sorry i guess i copied my script incorectly i did have the Next variable
thanks for helping me!! i apreciate it