Hello so i've ran into an issue. Whenever i loop a for loop, it creates enormous lag and delay. Is there any fix to this?
LocalScript:
--Example script, there might be errors since i just wrote this code. while wait() do for i,v in next, game:GetDescendants() do if v:IsA("Instance") then v.Changed:Connect(function(p) game:GetService("ReplicatedStorage"):FindFirstChild("Prop", true):FireServer(v, tostring(p), v[tostring(p)]) end) end end end
Simple. Incase if you dont understand, the localscript is supposed to get every object in game and detect if the property change.
ServerScript (Prop remote):
local PropRemote = game:GetService("ReplicatedStorage"):FindFirstChild("Prop") or false PropRemote.OnServerEvent:Connect(function(plr, part, prop, value) part[prop] = value end)
NOTE: Yes i do know that i can do it from a serverscript without needing remote events.