I have a difficulty chart with 200 stages of obby, I noticed many people are laggy and not many people are playing because of it, so I made this loop function, does this cause lag or makes game with no lag?
local script:
local distance = 250
while wait(25) do
for i, v in pairs(game.Workspace:GetDescendants()) do
if v:IsA("BasePart") and (game.Players.LocalPlayer.Character.HumanoidRootPart.Position - v.Position).magnitude >= distance and v.Name ~= "Baseplate" and not v.Parent:FindFirstChild("Humanoid") then
v.Transparency = 5
elseif v:IsA("BasePart") and v.Name ~= "Baseplate" and not v.Parent:FindFirstChild("Humanoid") then
v.Transparency = 0
end
end
end
What it does is, if player is in stage 15, they can only see until 10-20 stages
more than 250 studs = not visible
i thought this can work please tell me