Button not scaling

Hey devs -

I’m trying to make a system where the player can click on a button that will have a certain players’ name on it in order to 1v1 them.

Problem is, everything is working fine, but no matter what I do the inserted buttons into the frame will not scale.

Originally, I was told to change my code from creating the button to instead getting a clone from somewhere else (Replicated Storage, in my case) which was already scaled. I thought for sure this would work so I closed the topic.

Now that I am testing it, I get the same effect. (JSYK I am using a scaling plugin to scale it)

Here is the script to insert the already-scaled button:

game.ReplicatedStorage.OneVOne.Refresh.OnClientEvent:Connect(function()
	script.Parent.Parent.Refreshing.Visible = true
	wait(1)
	script.Parent.Parent.Refreshing.Visible = false

	for ii, vv in pairs(script.Parent:GetChildren()) do
		if vv:IsA("TextButton") then
			vv:Destroy()
		end
	end
	for i, v in pairs(game.Players:GetChildren()) do
		local buttonclone = game.ReplicatedStorage.Resources.InsertTo1v1:Clone()
		buttonclone.Parent = script.Parent
		buttonclone.Name = v.Name
		buttonclone.BackgroundColor3 = Color3.new(1, 0.0784314, 0.247059)
		buttonclone.TextColor3 = Color3.new(1, 1, 1)
		buttonclone.Font = Enum.Font.ArialBold
		buttonclone.TextTransparency = 0
		buttonclone.TextColor3 = Color3.new(0, 0, 0)
		buttonclone.Text = v.Name
		buttonclone.TextScaled = true
		
		buttonclone.OneVeOneClickScript.Enabled = true
		print("Created your button")
	end
end)

This is a really goofy error, welp.

2 Likes

pretty sure the issue is that the button itself uses offset and not scale.

show me the button and its properties

2 Likes

1 Like

If you want it to take up the full width of the frame it’s in, change the Size X to 1,0

1 Like

Does the ScrollingFrame (or Frame) in question use a UIGridLayout?

1 Like

This isn’t a script problem just a sizing problem.
Best way to fix this is to use a plugin like AutoScale Lite to convert the offset into Scale and so that way it’ll scale properly.

1 Like

I do not want it to take up the whole frame, rather the size as shown in the first picture

1 Like

Yes, it does use a gridlayout. Any other suggestions

1 Like

The buttons that I cloned are scaled using that exact plugin

1 Like

Is the scale of the UIGridLayout the same size of the scaled buttons?

1 Like

Sorry, I’m not quite sure what you mean - the uigrid has no scale property

1 Like

Well, i meant to say is the is the CellSize the same size as the scaled buttons?

1 Like

Oh! I didn’t think of this! I’ll check when I get home and I’ll mark you as the solution if this solves it! :smiley:

Ok, hopefully that helps. (Character Limit lol)

1 Like

I set the button size to the same size as the cells and its still not working

FRAME:
image

UiGrid:
image

This error I swear…

Change CellSize to scale instead of offset? It’s still on offset

Can you show me the instance hierarchy? (layout of the objects children.)

All good I solved it I’ll give u solution

1 Like

glad you were able to figure out.

1 Like

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