How do I make a graphics save system?

Well, recently I am making a game and the map is extensive, and therefore not many computers will be able to play it, so I made a system of lowering, raising the quality of shadows and turning shadows on and off, but I want them to be saved to the press the off or on button for when you enter again this as you set before

1 Like

Use datastore to save it.

I know, but how do I use it in “Shadow Global” from “game.Lighting”

Can you explain more on what you are trying to achieve? I might be able to help.

What I want to do is that when I click a textbutton, either activate or deactivate, it is saved with datastore or something, for when you enter, load the saved, this is my script to turn off shadows:

local bajo = script.Parent.Bajo
local Medio = script.Parent.Medio
local Alto = script.Parent.Alto
local luz = game.Workspace.Comisaria.Luz
local luzCelda = game.Workspace.Comisaria.CeldaLuz

bajo.MouseButton1Down:Connect(function()
game.Lighting.GlobalShadows = false
for i, x in pairs(luz:GetChildren()) do
x.PointLight.Shadows = false
x.PointLight.Brightness = 0.35
for i, x in pairs(luzCelda:GetChildren()) do
x.PointLight.Shadows = false
x.PointLight.Brightness = 0.35
end
end
end)

Medio.MouseButton1Down:Connect(function()
game.Lighting.GlobalShadows = true
for i, x in pairs(luz:GetChildren()) do
x.PointLight.Shadows = false
x.PointLight.Brightness = 0.35
for i, x in pairs(luzCelda:GetChildren()) do
x.PointLight.Shadows = false
x.PointLight.Brightness = 0.35
end
end
end)

Alto.MouseButton1Down:Connect(function()
game.Lighting.GlobalShadows = true
for i, x in pairs(luz:GetChildren()) do
x.PointLight.Shadows = true
x.PointLight.Brightness = 0.75
for i, x in pairs(luzCelda:GetChildren()) do
x.PointLight.Shadows = true
x.PointLight.Brightness = 0.75
end
end
end)

Use a remote event to a server script (as datastores can only run in server scripts), save it using SetAsync(yourkey), and that’s done.

Could you give me a more advanced example please?

So you put a local script in the text button, when pressed, if shadows are enabled, fire a remote event to a server script. Then, use the remote event to transfer the shadowsenabled boolean value, and save it to the datastore.

I understand a bit, I already did the remote Event thing, but I don’t know how to do the DataStore thing

Well this is my script to turn on / off shadows:

local luz = game.Workspace.Comisaria.Luz
local luzCelda = game.Workspace.Comisaria.CeldaLuz
local bajo = script.Parent.Bajo
local Medio = script.Parent.Medio
local Alto = script.Parent.Alto
local graficos = game.ReplicatedStorage.Graficos

bajo.MouseButton1Down:Connect(function()
graficos.ShadowB:FireServer()
game.Lighting.GlobalShadows = false
for i, x in pairs(luz:GetChildren()) do
x.PointLight.Shadows = false
x.PointLight.Brightness = 0.35
for i, x in pairs(luzCelda:GetChildren()) do
x.PointLight.Shadows = false
x.PointLight.Brightness = 0.35
end
end
end)

Medio.MouseButton1Down:Connect(function()
graficos.ShadowM:FireServer()
game.Lighting.GlobalShadows = true
for i, x in pairs(luz:GetChildren()) do
x.PointLight.Shadows = false
x.PointLight.Brightness = 0.35
for i, x in pairs(luzCelda:GetChildren()) do
x.PointLight.Shadows = false
x.PointLight.Brightness = 0.35
end
end
end)

Alto.MouseButton1Down:Connect(function()
graficos.ShadowA:FireServer()
game.Lighting.GlobalShadows = true
for i, x in pairs(luz:GetChildren()) do
x.PointLight.Shadows = true
x.PointLight.Brightness = 0.75
for i, x in pairs(luzCelda:GetChildren()) do
x.PointLight.Shadows = true
x.PointLight.Brightness = 0.75
end
end
end)

And this is the ServerScriptService script that makes the boolvalue and activates the value but I don’t know how to make the boolvalue activate the other part of the script to save the globalshadow:

local graficos = game.ReplicatedStorage.Graficos

local DataStore = game:GetService(“DataStoreService”)

local MyDataStore = DataStore:GetDataStore(“MyDataStore”)

local Players = game:GetService(“Players”)

game.Players.PlayerAdded:Connect(function(player)

local GraficosFol = Instance.new(“Folder”)

GraficosFol.Name = “Graficos”

GraficosFol.Parent = player

local ShadowBoolBajo = Instance.new(“BoolValue”)

ShadowBoolBajo.Name = “Bajo”

ShadowBoolBajo.Parent = GraficosFol

local ShadowBoolMedio = Instance.new(“BoolValue”)

ShadowBoolMedio.Name = “Medio”

ShadowBoolMedio.Parent = GraficosFol

local ShadowBoolAlto = Instance.new(“BoolValue”)

ShadowBoolAlto.Name = “Alto”

ShadowBoolAlto.Parent = GraficosFol

end)

game.ReplicatedStorage.Graficos.ShadowB.OnServerEvent:Connect(function(player)

game.Players:FindFirstChild(player.Name).Graficos.Bajo.Value = true

game.Players:FindFirstChild(player.Name).Graficos.Medio.Value = false

game.Players:FindFirstChild(player.Name).Graficos.Alto.Value = false

end)

game.ReplicatedStorage.Graficos.ShadowM.OnServerEvent:Connect(function(player)

game.Players:FindFirstChild(player.Name).Graficos.Bajo.Value = false

game.Players:FindFirstChild(player.Name).Graficos.Medio.Value = true

game.Players:FindFirstChild(player.Name).Graficos.Alto.Value = false

end)

game.ReplicatedStorage.Graficos.ShadowA.OnServerEvent:Connect(function(player)

game.Players:FindFirstChild(player.Name).Graficos.Bajo.Value = false

game.Players:FindFirstChild(player.Name).Graficos.Medio.Value = false

game.Players:FindFirstChild(player.Name).Graficos.Alto.Value = true

end)

game.Players.PlayerAdded:Connect(function(player)

local valueBajo = Players.PlayerAdded:FindFirstChild(player.Name).Graficos.Bajo

end)