Can't add GuiObjects during runtime?

In my script, I’ve tried to add frames to different GUIobjects during runtime, but it doesn’t work. Is there a reason why?

Can we see the code you wrote?

1 Like
--localscript
Button.ChildAdded:Connect(function(child)
print(child:GetFullName(), 'added')
end)

Instance.new("Frame").Parent = Button.Parent

--modulescript

		print('created frame')
		local Frame = Instance.new("Frame")
		Frame.BackgroundColor3 = Color
		Frame.Size = UDim2.fromScale(Thickness, Thickness)
		Frame.Position = Corners[i]
		Frame.Parent = ParentObject
		print(Frame.Parent:GetFullName())

In the localscript, It prints that a child is added but when I check explorer/my screen child doesnt exist, same for modulescript.

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