Scaling down a GUI when an object is clicked

Why not use Udim2.new instead of fromscale?

Extra unneeded parameters with the same outcome. I’ve switched to offset instead of scale to see if that would work.

1 Like

No change - here is what is happening in video:

robloxapp-20230420-1605479.wmv (1021.0 KB)

Looks like the frame isn’t sizing properly not sure why as you’re using division.

Your editing a Frame that’s inside workspace not the one in PlayerGui. Change the code so that it edits the correct one.

I am, but it is a BillboardGui underneath the block so it dosent (i think) replicate it to PlayerGui

It’s hard to really say what’s wrong at this point, I’m lost in your structure and what your trying to edit…

Its just a health bar that decreases by a quarter every time you click the corresponding part. I just need the way to size the frame down by a quarter until it disappears.

Final attempt; game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function(gui)
local frame = workspace.Folder.kabob.BillboardGui.Frame
frame.Size = UDim2.new(frame.Size.X / 2, frame.Size.Y)
end)

If you want a quarter change the 2 to 4

Unless you’re firing on server instead of client.

Aren’t you basically just dividing the size by half every time?
If you want the bar to go down by 1/4 evenly then you’re gonna subtract the size by 1/4 of the original size.

Say the size is like 200? You can do the math like this (assuming the frame.Size.X is 200):

frame.Size = UDim2.fromScale(frame.Size.X.Scale - 200/4, frame.Size.Y.Scale)

Of course you can change the 200 to the AbsoluteSize.X of the parent (if there’s no change to the parent while the health bar is decreasing, or you can make a variable with the max limit beforehand.

1 Like

Why not just divide the size by 4? Instead of size - size/4

That would make the health bar 1/4 of the original size, or the bar go down by 3/4.

I’ve just got a LocalScript underneath the BillboardGui - its still not working, I think it might be something on my end like script position or similar.
image

The code:
game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function(gui)
	local frame = workspace.Folder.kabob.BillboardGui.Frame
	frame.Size = UDim2.new(frame.Size.X / 2, frame.Size.Y)
end)

No but it checks for the size every time the remote event was fired.

Is the size of the frame the same size or smaller than the billboard?

Is there an error???

Why character limit?

The same size - {0, 200},{0, 50}

Nope

a a a a a a a character limit