Opening an gui frame

Not sure if this belongs here but my gui is not opening when it should. After I kill an npc there should be a line of code which checks that the backpack space is big enough to add the new amount and if not it should activate a gui which states there is not enough room but it does not. I have checked the properties and the frame has been turned to visible and I put a print statement in which is being fired, but the gui is not opening. Even if I try to open it by ticking the visible box manually but nothing I can think of is working.

This is the code to open the gui, which is attached to the npc in the workspace

image

1 Like

Do you receive any errors in the Output window?

Seems fine to me… I copied script and have no errors on Studio.

However I will not use your script as it is not mine. By the way.

Basically you wrote local errorGui = game.StarterGui.ErrorGui and you need to refrence that gui in player’s PlayerGui folder

1 Like

There were no errors displayed in the output window

This script is a normal script which is parented by the NPC that I am killing, how would I access the playerGui through a normal script, as I tried to access it using the tag variable but that did not work.

‘’’
local errorGui = tag.PlayerGui.ErrorGui
‘’’

Is that tag thing an object value or what?

Did doing local errorGui = tag.PlayerGui.ErorrGui print any errors? If so, can you tell us?

On line 5 it should be:

local function died()

It doesn’t matter if it’s local or not. It would just make it local, but here it’s useless.

Yes there was an error but I am away from my laptop to check until tomorrow night

The output window printed the error:
‘’’
PlayerGui is not a valid member of ObjectValue “Workspace.Dummy.Humanoid.creator”
‘’’
So i used the code:
‘’’
local errorGui = tag.Value:FindFirstChild(“PlayerGui”)
‘’’
and that has fixed the problem

That’s because you need to do Workspace.Dummy.Humanoid.creator.Value. You need to put .Value at the end. You are trying to find PlayerGui inside the creator tag, but you should find the PlayerGui inside the value of the creator tag (Which is a player).