I was researching way’s to workaround Roblox’s Render Distance for a game that’s supposed to be massive and glitchy looking, and I found this project.
ExampleProject.rbxl (108.0 KB)
and specifically, this piece of code is what i need.
local Player = game.Players.LocalPlayer
local Asset = game.ReplicatedStorage.Skyboxes:Clone()
local Classes = {"BasePart"}
local Skyboxes = {}
Asset.Parent = workspace.CurrentCamera--Player.Character
check = function(Obj)
for _,c in pairs(Classes) do
if (Obj:IsA(c)) then
return true
end
end
end
scan = function(Parent)
for _,Obj in pairs(Parent:GetChildren()) do
if ((Classes) and (check(Obj))) then
table.insert(Skyboxes,Obj)
elseif (not Classes) then
table.insert(Skyboxes,Obj)
end
scan(Obj)
end
end
scan(Asset)
game:GetService("RunService").RenderStepped:connect(function()
for i,v in pairs (Skyboxes) do
v.CFrame = CFrame.new(workspace.CurrentCamera.CoordinateFrame.p+(v.OriginalPosition.Value-workspace.CurrentCamera.CoordinateFrame.p).unit*4000)
local Constant = (v.OriginalPosition.Value-workspace.CurrentCamera.CoordinateFrame.p).magnitude/4000
v.Mesh.Scale = v.OriginalScale.Value/Constant
end
end)
The thing is, for the life of me I cannot figure out how to implement this into my own project.
This below is the structure for basically everything in the model
Someone please help me understand how to implement this properly, because currently these are the results.