I am trying to make this here function with more than the single part it is functioning with right now. I know that the while wait loop will cause it to only work for one part, so what is a way I can try to make it work for all the hotParts?
for _, hotParts in pairs(CS:GetTagged("HotPart")) do
local killTimer = 3
while task.wait(killTimer) do
print(hotParts.BrickColor, hotParts.Name)
if hotParts.BrickColor == BrickColor.new("CGA brown") then
print("hot yes")
hotParts.BrickColor = BrickColor.new("Medium stone grey")
elseif hotParts.BrickColor == BrickColor.new("Medium stone grey") then
print("yes cold")
hotParts.BrickColor = BrickColor.new("CGA brown")
end
end
end
I have tried making it it’s own function but didn’t change anything, i feel as though I am forgetting something simple to make it work, can anyone please help me?
I’d appreciate it ! 