Hi,
I have this system for a low detail mode toggle; one of the things it does is disable textures, which works by caching the transparency values of textures on parts with a NumberValue, which is stored as a child to the texture instance. The thing is: Since I use streaming enabled, (can’t really disable this since the game’s map is massive, nor can I split things into separate places) when you turn off the low detail mode setting but have loaded more instances by moving around, it tries to reset the texture transparency only to find that there’s no transparency value in the instance. This also results in some textures appearing thus partially ruining the purpose of a low detail mode.
Is there any possible way I could temporarily load the entire workspace and unload it to fix this? (load and unload just on the client from a local script) Or any other sort of solution?
Here’s my code (local script):
local TopbarButtons = require(game.ReplicatedStorage.TopbarButtons)
local UselessButtonsTable = workspace.ControlRoomDetails.UselessThings:GetChildren()
local UselessChamberItemsTable = workspace.ICFRChamber.UnnecessaryDetails:GetChildren()
local UselessICFRItemsTable = workspace.ICFR.structure.UnnecessaryDetails:GetChildren()
local PipesAndVents = workspace.SupportAndOtherProps.Pipes:GetChildren()
local SupportBeams = workspace.SupportAndOtherProps.SupportBeams:GetChildren()
local Button = TopbarButtons.new()
:setImage("rbxassetid://256294290")
:setCaption("Settings")
:setDropdown({
TopbarButtons.new()
:setLabel("Low Detail Mode")
:bindEvent("selected", function()
game.Lighting.EnvironmentSpecularScale = 0
game.Lighting.GlobalShadows = false
game.Lighting.DepthOfField.Enabled = false
for i,v in pairs(workspace:GetDescendants()) do
if v:IsA("Texture") then
if not v:FindFirstChild("TransparencyValueObject") then
local TransparencyValue = Instance.new("NumberValue",v)
TransparencyValue.Name = "TransparencyValueObject"
TransparencyValue.Value = v.Transparency
end
v.Transparency = 1
end
end
for i,v in pairs(UselessButtonsTable) do
v.Parent = nil
end
for i,v in pairs(UselessChamberItemsTable) do
v.Parent = nil
end
for i,v in pairs(UselessICFRItemsTable) do
v.Parent = nil
end
for i,v in pairs(PipesAndVents) do
v.Parent = nil
end
for i,v in pairs(SupportBeams) do
v.Parent = nil
end
workspace.Lava.Magma.SurfaceGui.Enabled = false
end)
:bindEvent("deselected", function()
game.Lighting.EnvironmentSpecularScale = 0.6
game.Lighting.GlobalShadows = true
game.Lighting.DepthOfField.Enabled = true
for i,v in pairs(workspace:GetDescendants()) do
if v:IsA("Texture") and then
v.Transparency = v.TransparencyValueObject.Value
end
end
for i,v in pairs(UselessButtonsTable) do
v.Parent = workspace.ControlRoomDetails.UselessThings
end
for i,v in pairs(UselessChamberItemsTable) do
v.Parent = workspace.ICFRChamber.UnnecessaryDetails
end
for i,v in pairs(UselessICFRItemsTable) do
v.Parent = workspace.ICFR.structure.UnnecessaryDetails
end
for i,v in pairs(PipesAndVents) do
v.Parent = workspace.SupportAndOtherProps.Pipes
end
for i,v in pairs(SupportBeams) do
v.Parent = workspace.SupportAndOtherProps.SupportBeams
end
workspace.Lava.Magma.SurfaceGui.Enabled = false
end)
})
Thanks in advance!