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 4 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?

script.Parent.Text = notification.Value

notification.Changed:connect(function(property)
        script.Parent.Text = notification.Value
    if notification.Value == "29" then
        script.Parent.TextColor3 = Color3.new(1, 1, 0)
    elseif notification.Value == "19" then
        script.Parent.TextColor3 = Color3.new(1, .5, .5)
    elseif notification.Value == "10" then 
        script.Parent.TextScaled = true
        script.Parent.TextColor3 = Color3.new(1, .25, .25)
    elseif notification.Value == "5" then
        script.Parent.TextColor3 = Color3.new(1, 0, 0)
    elseif notification.Value == "   " then
        script.Parent.TextScaled = false
    script.Parent.TextColor3 = Color3.new(1, 1, 1)
    end
end)            
1
Put a wait() when you run a loop else it can brake very easily bostaffmanbulgaria1 89 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago
script.Parent.Text = notification.Value

notification.Changed:connect(function(property)
wait()
        script.Parent.Text = notification.Value
    if notification.Value == "29" then
        script.Parent.TextColor3 = Color3.new(1, 1, 0)
    elseif notification.Value == "19" then
        script.Parent.TextColor3 = Color3.new(1, .5, .5)
    elseif notification.Value == "10" then 
        script.Parent.TextScaled = true
        script.Parent.TextColor3 = Color3.new(1, .25, .25)
    elseif notification.Value == "5" then
        script.Parent.TextColor3 = Color3.new(1, 0, 0)
    elseif notification.Value == "   " then
        script.Parent.TextScaled = false
    script.Parent.TextColor3 = Color3.new(1, 1, 1)
    end
end)            
Ad

Answer this question