Help with SurfaceGUI: why isn't the Frame expanding

I have a frame in a SurfaceGui (on a Part) and it isn’t changing size.
I need help with this.

I’ve tried changing the variables, but to no avail…

Script
local meter = script.Parent --Parent is named Blue in the Explorer
local timer = meter.Size.X.Scale
local timer2 = timer
wait(1)
for timer2 = 1, 10 do
	timer = timer2/10 
	wait(.1)
end
Filepath

In workspace
Screen Shot 2020-09-16 at 1.26.04 PM
It is a serverscript, not a local script.

If I am correct for the local script to run, you should put the SurfaceGui in StarterGui and set the SurfaceGui’s adornee to the part you want.

I can still see it, even without it being in starterGui, but i’ll try that.
By the way, the script is not a local script.
Wait… could that be it?

Oh yea didn’t notice it was a server script, it needs to be a local script.

Yeah, it didn’t work.
I tried all the solutions, in the part itself (localscript) and in starterGui (serverscript/localscript)

Well I can’t try to help you with the script that much because I’m not home right now and my phone is about to run out of battery. For right now I would look on a tutorial for a SurfaceGui button right now, sorry.

1 Like

This is really a mess, let me edit that a bit.

local meter = script.Parent;

for i = 1, 10 do
	meter.Size.X.Scale = i / 10;

	wait(0.1);
end

I don’t know what do you mean by your previous code, but I think that the edited version is what you wanted.

Other than that, it should work, give it a try.

Also, you don’t need localscripts in order for surfacegui to work .
You can use serverscript (if placed under workspace) if you want every player to see the changes.
However it doesn’t apply for screenguis

That gives me an error:
13:55:38.099 - Scale cannot be assigned to
line 4, to be exact.

That’s only if you want to code buttons.

That’s a weird error I must say…
This is my first time seeing it lol.

Give me 2 mins…

Ooh I am dumb, I forgot about UDim2
Sorry lol

local meter = script.Parent;

for i = 1, 10 do
    local size = meter.Size;
	meter.Size = UDim2.new(i / 10,size.X.Offset,size.Y.Scale,size.Y.Offset);

	wait(0.1);
end

Gives the same error when testing.


But line 5 this time.

I edited the code.
Remove .X.Scale.

Sorry, it’s just night for me right now…

1 Like