"Key not found in class"

I was trying to make a custom UI for the ProximityPrompt. When the player enters the radius the of the prompt the GUI tweens. The problem is that it throws a weird error. I tried adding it to a variable which did not work. And yes the object does exist in the location.

Here is my setup in the Explorer:
image

Here is my code (located inside the localscript). The serverside script does not have anything to do with this problem:

local Gui = script.Parent.Parent.InteractionGui --Error happens here (shown in the picture below)

script.Parent.PromptShown:Connect(function()
    Gui.MainFrameBG:TweenSize() --TODO: add tween
end)

Here is an image of the script error:
image

2 Likes

Sometimes the script is so fast that it can not detect other Instances I also experienced that you can try to restart the studio or use FindFirstChild

local Gui = script.Parent.Parent:FindFirstChild("InteractionGui")

Also local scripts cant work in parts you can read more here (LocalScript)

4 Likes

I just found out that adding “–!nonstrict” to your script fixes this.

EDIT: The localscript does function. It also works in ProximityPrompts for custom UI handling.

2 Likes