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

Something did this and unexpectedly removed this?

"Something unexpectedly tried to set the parent of ChunkB1 to NULL while trying to set the parent of ChunkB1. Current parent is Camera."

--PROXTECH GFX
wait()
--CAN EDIT(Not suggested)

RangeLow = 300 --Ammount of studs a distance can be maximum to load a chunk on Low Render(0)
RangeMedium = 550 -- Rangelow but on Medium Render(1)
RangeHigh = 1300 -- Rangelow but on High Render(2)
FogEnabled = false --Do not touch
FogDistLow = 800 -- The Distance for fogstart(Lowers lagg on some computers)
FogDistHigh = 1200 -- FogDistLow but on Higher fogstart


--CAN EDIT(Not suggested)

--DO NOT EDIT

Plr = game.Players.LocalPlayer
Cam = game.Workspace.CurrentCamera
Rend = script.Render
Map = Plr.PlayerGui:FindFirstChild("MAP")

--DO NOT EDIT


while wait() do --Loop things and stuff
	repeat wait() until Plr.Character:FindFirstChild("Torso") -- Wait until torso exists
	if Map ~= nil then --BEGIN RENDER
		for i,v in pairs(Map:GetChildren()) do --Collect Chunks
			Mag = (v.ChunkPlate.Position - Plr.Character.Torso.Position).magnitude
			if Rend.Value == 0 then
				script.RenderDist.Value = RangeLow
				if Mag <= RangeLow then
					v.Parent = Cam
					CDE = script.ChunkDest:Clone()
					CDE.Parent = v
					CDE.RendMax.Value = RangeLow
					CDE.Player.Value = Plr
					CDE.Disabled = false
				end
			elseif Rend.Value == 1 then
				script.RenderDist.Value = RangeMedium
				if Mag <= RangeMedium then
					v.Parent = Cam
					CDE = script.ChunkDest:Clone()
					CDE.Parent = v
					CDE.RendMax.Value = RangeMedium
					CDE.Player.Value = Plr
					CDE.Disabled = false
				end
			elseif Rend.Value == 2 then
				script.RenderDist.Value = RangeHigh
				if Mag <= RangeHigh then
					v.Parent = Cam
					CDE = script.ChunkDest:Clone()
					CDE.Parent = v
					CDE.RendMax.Value = RangeHigh
					CDE.Player.Value = Plr
					CDE.Disabled = false
				end
			end
		end
	end
end

This is the only part of the script that does parent this thing only, The rest of the script is unimportant

After it says that message I find the chunks that I tried to load as empty models with only scripts and etc and no parts, This is infact confusing me really bad, I would really like some help

3 comments

0

According to other solutions it is caused by setting two different parents for one thing at once, That may be the cause for other people, But I only set one parent for this

0

This often happens when something is created and immediately destroyed. Before you destroy something, add a wait(). This may seem like a stupid solution but it solves the problem.

0

@jobro I have tried, Did not work

1 answer

You'll need to provide more context. What other code do you have running that affects ChunkB1?

4 comments

0

The code is too valuable to begin with...

0

Chunk B1 is not the only chunk that it is rendering but I have updated the script to include the full script, This better be worth it

0

Which line is the error on?

0

Does not say

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