So I made an if and then statement that checks whether if the part name is equal to the index value then it would do some kind of code. But for some reason, it doesn’t seem to recognize that. Is there any way that you could check if the part name is equal to some value of a variable???
Here is the code if your wondering:
while true do
local simonPicker = math.random(#simonOrNot)
local simonPicked = simonOrNot[simonPicker]
-- print(simonPicked)
local colourPicking = math.random(#colourPicker)
local colourPicked = colourPicker[colourPicking]
local colourIndex = table.find(colourPicker, colourPicked)
-- print(colourPicked)
print(colourIndex)
ColourTiles(gamemodeClone.Tiles)
if simonPicked == "Simon says go to " then
for i = 5, 0, -1 do
status.Value = simonPicked..colourPicked..i
wait(1)
end
for _,Part in ipairs(gamemodeClone.Tiles:GetChildren()) do
if Part:IsA("Part") then
if not Part.Name == colourIndex then
print("not = to colour index")
for i = 0, 1, 0.0625 do
Part.Transparency = i
wait()
end
Part.CanCollide = false
end
end
end
status.Value = simonPicked..colourPicked
wait(3)
elseif simonPicked == "Go to " then
for i = 5, 0, -1 do
status.Value = simonPicked..colourPicked..i
wait(1)
end
for _,Part in ipairs(gamemodeClone.Tiles:GetChildren()) do
if Part:IsA("Part") then
if Part.Name == colourIndex then
print("part = to colour index")
for i = 0, 1, 0.0625 do
Part.Transparency = i
wait()
end
Part.CanCollide = false
end
end
end
status.Value = simonPicked..colourPicked
wait(3)
end
for _,Part in ipairs(gamemodeClone.Tiles:GetChildren()) do
if Part:IsA("Part") then
Part.Transparency = 0
Part.CanCollide = true
end
end
wait(3)
end