I see a (bug?) that objects disappear from the game when transparency is 0 and can collide is false.When I run the game, it works as intended until i change FirstTycoon to 1 in theory it should make the parts appear. however instead it deletes the parts.
function hide(model)
local children = model:GetChildren()
for i = 1, #children do
local child = children[i]
if child:IsA("Part") then
print("hide")
child.Transparency = 0.0
child.CanCollide = false
end
if child:IsA("Model") then
hide(child)
end
end
end
function show(model)
local children = model:GetChildren()
for i = 1, #children do
local child = children[i]
if child:IsA("Part") then
print("show")
child.Transparency = 1.0
child.CanCollide = true
end
if child:IsA("Model") then
show(child)
end
end
end
while true do
wait()
if script.Parent.Parent.Parent.FirstTycoon.Value>=tonumber(script.Parent.Name)then
show(script.Parent)
print("shown all")
else
hide(script.parent)
end
end
The output is:
Access Granted
48panda48 applied edits to script BuyScript1
48panda48 applied edits to script Script
hide (x138)
shown all (x4607)
It is happening in Roblox studio test(non server). If it is a roblox side bug how can i get around it? If it's my error, what is it? Thanks.

2 comments
Yes, I forgot to anchor it. I anchored them and now it works perfectly, thanks!
Your welcome!