The script for some reason runs in a loop and no models appear, they’re all invisible and it constantly gives out prints infinitely and it doesn’t actually end ever. I’m really confused as to why this is happening.
I’ve asked others for help and nobody really has any idea what’s happening to cause this. Any additional help would be fantastic.
Here’s the script if anyone is curious about it.
local button = workspace.GalleryMonitor1.Screen.Icons
function Swap(modeltoappear)
modeltoappear = workspace:WaitForChild("GalleryModels")
for i,v in pairs (workspace.GalleryModels:GetDescendants()) do
if v.Name ~= modeltoappear.Name then
for i,v in pairs(workspace.GalleryModels:GetDescendants()) do
wait()
if v:IsA("Texture") then
v.Transparency = 1
print("11")
end
if v:IsA("Decal") then
v.Transparency = 1
print("15")
end
if v:IsA("UnionOperation") then
v.Transparency = 1
print("19")
end
if v:IsA("Part") then
v.Transparency = 1
print("23")
end
end
else
for i,v in pairs(workspace.GalleryModels:GetDescendants()) do
wait()
if v:IsA("Texture") then
v.Transparency = 0
print("25")
end
if v:IsA("Decal") then
v.Transparency = 0
print("35")
end
if v:IsA("UnionOperation") then
v.Transparency = 0
print("39")
end
if v:IsA("Part") then
v.Transparency = 0
print("43")
end
end
end
end
end
button.Frame.FreddyFazbear.MouseButton1Click:Connect(function()
print("ok")
local modelSwap = script.Parent
Swap(modelSwap.Name)
end)
local button = workspace.GalleryMonitor1.Screen.Icons
function Swap(modeltoappear)
for i,v in pairs (workspace.GalleryModels:GetDescendants()) do
if v.Name ~= modeltoappear.Name then
for i,v in pairs(workspace.GalleryModels:GetDescendants()) do
wait()
if v:IsA("Texture") then
v.Transparency = 1
print("11")
end
if v:IsA("Decal") then
v.Transparency = 1
print("15")
end
if v:IsA("UnionOperation") then
v.Transparency = 1
print("19")
end
if v:IsA("Part") then
v.Transparency = 1
print("23")
end
end
else
for i,v in pairs(workspace.GalleryModels:GetDescendants()) do
wait()
if v:IsA("Texture") then
v.Transparency = 0
print("25")
end
if v:IsA("Decal") then
v.Transparency = 0
print("35")
end
if v:IsA("UnionOperation") then
v.Transparency = 0
print("39")
end
if v:IsA("Part") then
v.Transparency = 0
print("43")
end
end
end
end
end
button.Frame.FreddyFazbear.MouseButton1Click:Connect(function()
print("ok")
local modelSwap = script.Parent
Swap(modelSwap.Name)
end)
Could you share with us the structure of your folder, for myself doesn’t seem really smart to do a nested loop within the same loop which you’re already iterating. (GetDescendants already gets all the instances under that parent Instance).
When I mean share the structure, I mean a screenshot of the GalleryModels and within (expanded).
No, I just want to understand what you’re doing and what you’re writing, at the moment it doesn’t make any sense at all, could we take up this discussiong to Discord if you have any? Real-time communication would be faster.