Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Level-Of-Detail system working server-side instead of local? [SOLVED]

So i've been working on a level-of-detail system that would incrementally remove some details of the game and add them depending on what your quality level is (LOW, MED, HIGH). The problem I have been having is that, even a localscript in startergui with FE on is making the changes globally (everyone can see the objects disappear, regardless of who toggled it. I'm fairly certain it has to do with how i'm doing everything (the localscript moves the folder "L2" and "L1" according to your quality level in and out of serverstorage. i tried lighting too). I thought this could occur locally but apparently not. Is there any method of unloading objects locally (only visible to that player) so that the game can run smoother for certain people on lower-end PCs?

An example of the code, in one of the localscripts that should move a file is

if game:GetService("Lighting"):FindFirstChild("L2") then
	game:GetService("Lighting").L2.Parent = game:GetService("Workspace")
end
if game:GetService("Lighting"):FindFirstChild("L1") then
	game:GetService("Lighting").L1.Parent = game:GetService("Workspace")
end

print("Now at level 3 quality.")
wait()
script.Disabled = true

That is pretty much the same with Level 2 and Level 1, they just move L2 and L1 corresponding to the quality level.

4 comments

0

LocalScripts do things locally. Something is not as you say.

1

Don't use the Lighting service for storage; use ServerStorage when possible. If not possible, use Replicated Storage.

0

I've tried both Lighting and ServerStorage, but not ReplicatedStorage yet. I'll try that in a second.

0

It seems to be working when it's put in ReplicatedStorage, actually. Well, thanks!

1 answer

✓ Accepted answer

This kind of thing is generally managed by Roblox as to give the best user experience. It would also be best to include your system within the current Roblox quality setting, e.g:-

-- local script in StarterPlayerScripts

local localUserSettings = UserSettings().GameSettings

local function quolityChanged(qualLevel)
	
	if qualLevel == Enum.SavedQualitySetting.Automatic then
		-- how will you handle this???
	elseif qualLevel == Enum.SavedQualitySetting.QualityLevel10 then
		-- max quolity
		print('maxed')
	end
end

localUserSettings.Changed:Connect(function(prop)
	if prop == 'SavedQualityLevel' then
		quolityChanged(localUserSettings.SavedQualityLevel)
	end
end)

-- first time setup
quolityChanged(localUserSettings.SavedQualityLevel)

It may also help you to check the GetRealPhysicsFPS to change what is being displayed to help improve the FPS.

Other useful links:-

post-effects

This discussion is preserved as it was. New answers, comments, and votes are closed.