I’m trying to make the buttons from the left once cloned on the computer widget to have the same size in pixels.
Although the buttons on the left are in scale, and on the computer frame they’re in offset
Here’s my script for the conversion
newUI.title.MouseButton1Click:Connect(function()
local newC = newUI:Clone()
newC.Size = UDim2.fromOffset(newC.Size.X.Scale*cX,newC.Size.Y.Scale*cY)
task.wait()
newC.Parent = sWidget
newC.Position = UDim2.fromScale(0,0)
MakeGrabbable(newC.title,newC)
end)
NewUI reffers to the buttons on the left.
If neccersary, this is the entire script for rendering both the side buttons and conversion
local function LoadGateUI()
local loadindex = 0
local cin = 100
local sv = 0
for nodename, nodedata in pairs(Nodes) do
loadindex+=1
local newUI = nodeBase:Clone()
newUI.Parent = scroll
local sizefactor = 1/25
newUI.Position = UDim2.fromScale(0,(loadindex-1)/25+sv)
if #nodedata.inputs > 3 or #nodedata.outputs > 3 then
local top = #nodedata.inputs if #nodedata.outputs > #nodedata.inputs then top = #nodedata.outputs end
sizefactor = (1/25)*(top/4)
sv+= sizefactor-(1/25)
end
newUI.Size = UDim2.fromScale(0.934,sizefactor)
newUI.title.Text = nodename
newUI.BackgroundColor3 = nodedata.bcol
for order, input in pairs(nodedata.inputs) do
local NodeCopy = inpcopy:Clone()
NodeCopy.Size = UDim2.fromScale(0.03,1/#nodedata.inputs)
NodeCopy.Position = UDim2.fromScale(0,(order-1)/#nodedata.inputs)
NodeCopy.Name = input
NodeCopy.Parent = newUI
end
for order, output in pairs(nodedata.outputs) do
local NodeCopy = inpcopy:Clone()
NodeCopy.Size = UDim2.fromScale(0.3,1/#nodedata.outputs)
NodeCopy.Position = UDim2.fromScale(0.97,(order-1)/#nodedata.outputs)
NodeCopy.Name = output
NodeCopy.Parent = newUI
end
newUI.title.MouseButton1Click:Connect(function()
local newC = newUI:Clone()
newC.Size = UDim2.fromOffset(newC.Size.X.Scale*cX,newC.Size.Y.Scale*cY)
task.wait()
newC.Parent = sWidget
newC.Position = UDim2.fromScale(0,0)
MakeGrabbable(newC.title,newC)
end)
end
end