Cloning into player gui not working

-- Add icon
		local bannerHeight = pGui.personaCooldownInfo.row.Size.Y.Scale
		local iconWidth = bannerHeight * game.Workspace.Camera.ViewportSize.Y / game.Workspace.Camera.ViewportSize.X
		local icon = pGui.personaCooldownInfo.template:Clone()
		icon.Size = UDim2.new(iconWidth, 0, 1, 0)
		icon.Name = move.Name
		icon.moveName.Text = move.Name
		icon.Visible = true
		icon.Parent = pGui.personaCooldownInfo.row

This is part of a larger script.
Everything in this works. pGui is defined earlier

local pGui = game.Players.LocalPlayer.PlayerGui

It should be mentioned that the first code snippet is in a remote event connection. Everything else about that script works.
I even tried parenting the icon to game.Workspace, which remarkably worked fine. When I put it in pGui, or anything related to it, however, nothing appears.

EDIT: There are no errors or anything saying that I tried to index nil with “row” or “personaCooldownInfo” implying that anything doesn’t exist at the point of this script running. I even replaced all the dots in that statement with WaitForChild() and nothing changed. No infinite yield possible warning either, so it seems like it found it.

I think you forgot to add ScreenGui to PlayerGui.
As far as I know putting frames in PlayerGui does not render anything

Just edited; I had changed it for testing stuff. I have now set it so that it is in the correct frame in the ScreenGui. Still nothing.

I should add that it isn’t that the size is getting set to zero or something weird like. It just literally doesn’t exist in the explorer.

I remember having a similar problem a while ago, but sadly I don’t remember what solved it.

I think it was something about changing some properties before parenting the ui. On paper that sounds dumb to be the cause, but try it out.

Like parent the cloned ui first, change properties after.

Nothing, unfortunately.
I even tried instancing a random frame into it in the same code and got nothing again.

Where do you have your remote event in the explorer?

If the remote event is located in places like ServerScriptService it won’t run, even if you have a reference of it on both server and client.

In such cases there are also no errors in the output

Everything in the remote event functions correctly.
Heck, I can even do icon:GetFullName() and it says game.Players.iiCant_Read.PlayerGui.personaCooldownInfo.row.(move name).

damn, im afraid im out of ideas lol

For some reason, reset on spawn was the issue. I guess it makes sense, as this is triggering on characteradded, so maybe that event gets fired right before reset on spawn recognizes you spawned. Not sure.

1 Like

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