Plugins loading before studio causing bugs

If this happened in the last week or so, I also got a notification that one of my plugins broke. I haven’t looked into fixing it, yet, so I don’t know if it’s the same root cause.

1 Like

I have moved the post to studio bugs.

I would like to look into this. It would help if you could provide a minimal test case. Like you could post a simple-as-possible lua script that demonstrates the problem, clearly indicating what you expect to happen vs what actually happens.

1 Like

I guess specifically I want to zero in on “issue with DescendantAdded”. Give me the smallest script possible that makes the call to DescendantAdded, documenting what you expect to happen vs what actually happens.

1 Like

Sure! I will send the code soon

Here is the code to my automatic scaling feature. This script is located under a BoolValue object.

local startergui = game.StarterGui

function ToScale(guiobject)
game:GetService( 'RunService' ).RenderStepped:Wait()
local Viewport_Size

if guiobject:FindFirstAncestorWhichIsA("GuiObject") then
	Viewport_Size = guiobject:FindFirstAncestorWhichIsA("GuiObject").AbsoluteSize
else
	Viewport_Size = workspace.CurrentCamera.ViewportSize
end


local LB_Size = guiobject.AbsoluteSize
guiobject.Size = UDim2.new(LB_Size.X/Viewport_Size.X,0,LB_Size.Y/Viewport_Size.Y, 0)
end

startergui.DescendantAdded:connect(function(v)
    if game.Loaded and v:IsA("GuiObject") and not v:IsA("ScreenGui") and not v:IsA("Folder") and not v:IsA("StarterGui") and script.Parent and script.Parent.Value == true then
    --Convert to Scale
    ToScale(v)
	print("Auto Set Size to Scale")
    end 
end)

coroutine.resume(coroutine.create(function()
while wait(1) do
	if script.Parent then
	if plugin:GetSetting("Active") == true then
		script.Parent.Value = true
	else
		script.Parent.Value = false
	end
	end
end
end))

It is supposed to automatically set size of any GUIObject you insert into startergui when studio has loaded and you are creating UI to Scale, it is not supposed to detect the GUI being loaded into studio.

1 Like

Thanks.
Could I ask for an even more reduced script, and even more explicit description of expected vs actual behavior?

E.g. just a one-script-file plugin that does

local startergui = game.StarterGui
startergui.DescendantAdded:connect(function(v)
<something in here?>
end)

local startergui = game.StarterGui

function ToScale(v)
game:GetService( 'RunService' ).RenderStepped:Wait()
local Viewport_Size

if v:FindFirstAncestorWhichIsA("GuiObject") then
	Viewport_Size = v:FindFirstAncestorWhichIsA("GuiObject").AbsoluteSize
else
	Viewport_Size = workspace.CurrentCamera.ViewportSize
end

local LB_Size = guiobject.AbsoluteSize
guiobject.Size = UDim2.new(LB_Size.X/Viewport_Size.X,0,LB_Size.Y/Viewport_Size.Y, 0)
end

startergui.DescendantAdded:connect(function(v)
    if game.Loaded then
    --Convert to Scale
    ToScale(v)
    end 
end)

Expected Behaviour: Any gui object inserted manually after studio has loaded into StarterGUI is automatically converted to Scale size, so the default size is set to Scale.

Actual Behaviour: GUI inserted by studio while the game is loading is also converted to scale which is causing GUI to grow massive.

A post was merged into an existing topic: UI Editor not appearing

If you have a local script plugin with source as print(workspace:FindFirstChild'Baseplate') and open a default baseplate place it outputs nil

1 Like

This issue still seems to be unfixed.

1 Like

This issue seems to have been fixed, thanks :slight_smile:

It isn’t fixed; please see my repro @CycloneUprising

If it prints nil that means the plugin loads after the baseplate has loaded :eyes:

Which shouldn’t happen; the place should load before plugins run

No read the title, I wanted plugins to load AFTER the place loads :laughing:

Yes, we are saying the same thing

OH my bad lol I thought you were doing descendentadded like me, guess it’s still not fixed.

1 Like

It’s fixed now \\\\\\\\\\

3 Likes

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