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.
Hello, I don't see anything wrong with your script, but it maybe is the psychics. Because you forgot to anchor it, without putting child.Anchored = true
, or anchoring it on Properties. Instead it will fall down and will disappear. Also use script.Parent
instead. If it is Anchored, I think you should double-check your script.
Anchoring makes parts don't fall, if you notice the Baseplate does not fall, because it is anchored. But parts that are not anchored such as the player or parts that its Anchored is false, it will let it fall down. Without anchoring, I bet the Baseplate and almost all things will fall.