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

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

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 comment

1

Put a wait() when you run a loop else it can brake very easily

1 answer

✓ Accepted answer
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)            

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