Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can using local scripts to alter GUI elements cause any sort of network/server/connection-based lag?

Asked by 5 years ago

I know local scripts are done client-side, but since LUA is modular, could a local script cause any sort of connection/server/network based lag? As in, non performance/framerate related. Additionally, I'm not sure if this local script that changes GUI text is doing any sort of slow-down by doing a constant check for a specific value, if so, what could I do differently? Sorry for my lack of terminology and coding knowledge, but, TLDR; will Local Scripts, and in particular, this script cause any sort of slow-down?

01script.Parent.Text = notification.Value
02 
03notification.Changed:connect(function(property)
04        script.Parent.Text = notification.Value
05    if notification.Value == "29" then
06        script.Parent.TextColor3 = Color3.new(1, 1, 0)
07    elseif notification.Value == "19" then
08        script.Parent.TextColor3 = Color3.new(1, .5, .5)
09    elseif notification.Value == "10" then
10        script.Parent.TextScaled = true
11        script.Parent.TextColor3 = Color3.new(1, .25, .25)
12    elseif notification.Value == "5" then
13        script.Parent.TextColor3 = Color3.new(1, 0, 0)
14    elseif notification.Value == "   " then
15        script.Parent.TextScaled = false
16    script.Parent.TextColor3 = Color3.new(1, 1, 1)
17    end
18end)           
1
Put a wait() when you run a loop else it can brake very easily bostaffmanbulgaria1 89 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago
01script.Parent.Text = notification.Value
02 
03notification.Changed:connect(function(property)
04wait()
05        script.Parent.Text = notification.Value
06    if notification.Value == "29" then
07        script.Parent.TextColor3 = Color3.new(1, 1, 0)
08    elseif notification.Value == "19" then
09        script.Parent.TextColor3 = Color3.new(1, .5, .5)
10    elseif notification.Value == "10" then
11        script.Parent.TextScaled = true
12        script.Parent.TextColor3 = Color3.new(1, .25, .25)
13    elseif notification.Value == "5" then
14        script.Parent.TextColor3 = Color3.new(1, 0, 0)
15    elseif notification.Value == "   " then
16        script.Parent.TextScaled = false
17    script.Parent.TextColor3 = Color3.new(1, 1, 1)
18    end
19end)           
Ad

Answer this question