Hello. I was trying to make a script where there is a table, and if any of those things from the table are in the game, something is made invisible. I know mostly how to do it, but I don’t know how to make it so if anything in the table is in the game it happens. I only know how to make it for one. Here is the script.
maps = {"Map1","Map2","Map3","Map4"}
while true do
wait(0)
if game.Workspace.MapStorage:FindFirstChild(maps[]) then
game.Workspace.GoAway.Transparency = 1
game.Workspace.GoAway.GoAway2.Transparency = 1
game.Workspace.GoAway.Decal.Transparency = 1
game.Workspace.Fall.CanCollide = false
else
game.Workspace.GoAway.Transparency = 0
game.Workspace.GoAway.GoAway2.Transparency = 0
game.Workspace.GoAway.Decal.Transparency = 0
game.Workspace.Fall.CanCollide = true
end
end
Hi @jenae20!
There is a fairly simple way to solve this. To check if something that is in the table is in the game, a loop is required. Preferably a for loop.
local maps = {"Map1", "Map2", "Map3"}
for i, v in pairs(maps) do
if workspace.MapStorage:FindFirstChild(v) then
--code
else
--code
end
end
I made sure everything was spelt right, and they all were, but I found another way to make it work. I made it so it’s in a while true do loop, and if it sees the map, it waits the number of seconds the map stays to start checking again. I tried it without that last part, and it just flickered.