Does my script cause my game to lag?

Hello,

I have a script that changes BoolValues, would this script cause my games frames to drop?

Script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local settingsFolder = ReplicatedStorage:WaitForChild("Settings")
local clientHighlightEnabled = settingsFolder:WaitForChild("ClientHighlightEnabled")

local function playSound()
	script.Parent.Parent.Parent.Click:Play()
end

local function updateClientHighlight()
	if clientHighlightEnabled.Value == true then
		script.Parent.Text = "Highlight Player: ON"
	else
		script.Parent.Text = "Highlight Player: OFF"
	end
end

local function toggleClientHighlight()
	clientHighlightEnabled.Value = not clientHighlightEnabled.Value
	updateClientHighlight()
end

script.Parent.MouseButton1Click:Connect(function()
	playSound()
	toggleClientHighlight()
end)

clientHighlightEnabled.Changed:Connect(updateClientHighlight)

script.Parent.MouseEnter:Connect(function()
	script.Parent.BackgroundColor3 = Color3.new(1, 1, 0.498039)
end)

script.Parent.MouseLeave:Connect(function()
	script.Parent.BackgroundColor3 = Color3.new(0, 0, 0)
end)

I have 5 other local scripts that use this same format.

No, in fact its a pretty insignificant amount that it shouldn’t make the system slow down.
Only point of lag would be if you were to fire it a billion times a once.

Also:

Use .fromRGB, It will make your life easier.

is roblox having issues with there servers then?

In studio and in the actual games itself I lose a significant amount of frames for some reason, I’ve never experienced this before.

this is what I’m getting when playing in studio, I have zero clue as to why.

image

never mind, I found the issue lol

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.