What do you want to achieve?
I want the console to stop being flooded with this error.
What is the issue? The console keeps getting flooded and I don’t know how to fix it.
The script:
local addConveyor = function(c)
if c.Name == "CONVEYOR" then
local con
con = game:GetService("RunService").RenderStepped:Connect(function()
if not (c.Parent or c.Parent.Parent) then con:Disconnect() end
c.Parent.ConveyorTexture.OffsetStudsV = -(workspace.DistributedGameTime*c.Value)%(c.Parent.ConveyorTexture.StudsPerTileV)
end)
end
end
workspace.DescendantAdded:Connect(addConveyor)
for i,v in pairs(workspace:GetDescendants()) do
addConveyor(v)
end
local addConveyor = function(c)
if c.Name == "CONVEYOR" then
local con
con = game:GetService("RunService").RenderStepped:Connect(function()
if not c or not c.Parent or not c.Parent.Parent then con:Disconnect() end
c.Parent.ConveyorTexture.OffsetStudsV = -(workspace.DistributedGameTime*c.Value)%(c.Parent.ConveyorTexture.StudsPerTileV)
end)
end
end
workspace.DescendantAdded:Connect(addConveyor)
for i,v in pairs(workspace:GetDescendants()) do
addConveyor(v)
end
The error arises with c.Parent. C is nil so when you try to get its parent you receive an error. Checking to see if c is not nil first should fix this error.