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

Do inactive events affect performance?

game.ServerStorage.Light.Changed:Connect(function() -- BoolValue
	script.Parent.Enabled = game.ServerStorage.Light.Value
end)

I will duplicate that script and put to all lights, totally 68 scripts. The light value will rarely change. So is there any possibility of lag? How does event works? Is it always checking the value like while true do or is it firing all events when the value changes?

2 comments

0

ill try testing it

0

Every function call made on an event is a new thread. This would have a small impact on performance as this thread then needs to be managed.

1 answer

✓ Accepted answer

when you print a table or a function, it will say something like:

table/function:

that specific hex number shows its position in memory, now when i ran this code:


print({})

script.Parent.AncestryChanged:Connect(function()end)
script.Parent.AncestryChanged:Connect(function()end)
script.Parent.AncestryChanged:Connect(function()end)
script.Parent.AncestryChanged:Connect(function()end)
script.Parent.AncestryChanged:Connect(function()end)
script.Parent.AncestryChanged:Connect(function()end)
script.Parent.AncestryChanged:Connect(function()end)
script.Parent.AncestryChanged:Connect(function()end)
script.Parent.AncestryChanged:Connect(function()end)
script.Parent.AncestryChanged:Connect(function()end)
script.Parent.AncestryChanged:Connect(function()end)
script.Parent.AncestryChanged:Connect(function()end)
script.Parent.AncestryChanged:Connect(function()end)
script.Parent.AncestryChanged:Connect(function()end)
script.Parent.AncestryChanged:Connect(function()end)
script.Parent.AncestryChanged:Connect(function()end)
script.Parent.AncestryChanged:Connect(function()end)
script.Parent.AncestryChanged:Connect(function()end)
script.Parent.AncestryChanged:Connect(function()end)
script.Parent.AncestryChanged:Connect(function()end)
script.Parent.AncestryChanged:Connect(function()end)
script.Parent.AncestryChanged:Connect(function()end)
script.Parent.AncestryChanged:Connect(function()end)
script.Parent.AncestryChanged:Connect(function()end)
script.Parent.AncestryChanged:Connect(function()end)
script.Parent.AncestryChanged:Connect(function()end)
script.Parent.AncestryChanged:Connect(function()end)
script.Parent.AncestryChanged:Connect(function()end)
script.Parent.AncestryChanged:Connect(function()end)
script.Parent.AncestryChanged:Connect(function()end)
wait()
print({})

then it printed:

table: 360DF298 table: 366A1638

converting these numbers we get

906883736 912922168

im not sure what to do with these numbers because printing a blank table time to time could print a durastically different number, so i would not count on it, i does not appear to effect performance but i would still consider using a better method than what you have shown

3 comments

0

Thanks, whats best way to reduce lag?

0

maybe having only a single script connect to the event and have it change all of the lights at the same time rather than making every light do it independently

0

I tried that method at first but it's really hard to locate all lights in game...

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