I’m looking to improve optimization in this script (if possible). Any tips on optimizing this script (besides variable names) will help me. I’m trying to optimize my experience as much as possible!
Code:
local interactionPositions = {
[true] = UDim2.new(0.5, 0,0.88, 0),
[false] = UDim2.new(0.5, 0,0.94, 3),
}
RunService:BindToRenderStep("Checker", Enum.RenderPriority.Last.Value, function()
local target = Mouse.Target
local dbValid = (isDB~=nil)
InteractionNameLabel.Position = interactionPositions[dbValid]
if dbValid then
InteractionNameLabel.Text = isDB
InteractionNameLabel.Visible = true
return
elseif target then
local isInteract = target:FindFirstChild("InteractSettings")
if (isInteract) then
InteractionNameLabel.Text = isInteract.InteractName.Value
InteractionNameLabel.Visible = true
return
end
end
InteractionNameLabel.Visible = false;
end)
Actually I was wrong about your solution not working. Instead of if Target I had if isInteract when the variable "isInteract" is being assigned to. So I will give you the solution for this! Thank you for helping, and sorry for that slight error of mine!