So i made a simple little render system but when im too far away from the Parts they return their Transparecny
Example:
So i made a simple little render system but when im too far away from the Parts they return their Transparecny
Example:
Hey, First you would like to show anyone you are asking for help from with your script the SCRIPT itself of course…
And also Transparency will be very performance heavy, I would recommend you to store it inside the server so it won’t run on the client when far away.
You can store it inside ServerStorage for example.
Also, I just checked the video and I think you have made miscalculates there, When you go away it appears, And when you come closer they disapear.
hey, I tried with Storage but then the script dont know how far its away from the player so the items will be kepped in the Storage and do not come back
Ok, I see the problem.
If you would look closely, You typed:
(part.Position.Magnitude - character.PrimaryPart.Position.Magnitude)
Instead, it’s should look like this:
(part.Position - character.PrimaryPart.Position).Magnitude
Hope it helped!
I also recommend you to change while wait(1) do
to
game:GetService("RunService").RenderStepped:Connect(function()
It works good but one thing i noticed is its more laggy now, all i acutally wanna make is a little render system because Roblox streaming enabled feature dont really help much to unrender parts… etc
It only waits until player is in the specifc area but dont unload again…
You can replace it with while wait(1) do
if it’s a bit laggy, Altho I still think it’s better for the situation you are in.
local Game = game
local Workspace = workspace
local RunService = Game:GetService("RunService")
local Players = Game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local TransparencyCache = {}
local RenderDistance = 100
local function OnDescendantAdded(Descendant)
if not (Descendant:IsA("BasePart")) then return end
TransparencyCache[Descendant] = Descendant.Transparency
end
local function OnDescendantRemoving(Descendant)
Descendant.Transparency = TransparencyCache[Descendant]
TransparencyCache[Descendant] = nil
end
local function OnRenderStep()
local Pivot = Character:GetPivot()
for BasePart, Transparency in pairs(TransparencyCache) do
local Distance = (Pivot.Position - BasePart.Position).Magnitude
if Distance > RenderDistance then
BasePart.Transparency = 1
else
BasePart.Transparency = Transparency
end
end
end
RunService.RenderStepped:Connect(OnRenderStep)
Workspace.DescendantAdded:Connect(OnDescendantAdded)
Workspace.DescendantRemoving:Connect(OnDescendantRemoving)
for _, Descendant in ipairs(Workspace:GetDescendants()) do
OnDescendantAdded(Descendant)
end
Cool, imma try this, thanks for this!