I’m currently trying to remake my game and I have multiple GUIs, one for the player, and one for the shop and basically my issue is that when I try to run my script which opens the NPC dialog, I need it to make the player GUI invisible, but it gives me a "CharacterGUI is not a valid member of PlayerGui “Players.CodedCrystal.PlayerGui”
It seems I can’t grab two GUI in the same script using “script.Parent.(thegui)” same with if I try to use “game.StarterGUI.(thegui)” and if I try mixing and matching it just doesn’t make the playerGUI invisible, so I’m pretty lost
It also gives me the error when I can blatantly see that the GUI is right there and SHOULD be a valid member but it still says it isn’t, which is why I’m so confused.
Here’s my current script.
local clickdetector = workspace.ShopNPC.ClickDetector
local GUI = script.Parent.ShopGUI
local playerGUI = script.Parent.CharacterGUI
local shopGUI = GUI.DialogShadow
local playerFrame = playerGUI.playerFrame
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid.Animator
clickdetector.MouseClick:Connect(function()
if GUI.Enabled == true then
return 0
end
for i,v in pairs(character:GetChildren()) do
if v:IsA("BasePart") then
for i, v in pairs(animator:GetPlayingAnimationTracks()) do
if v ~= nil then
v:Stop()
end
end
v.Anchored = true
clickdetector.MaxActivationDistance = 0
GUI.Enabled = true
GUI.ShopDialogScript.Disabled = false
playerFrame.Visible = false
repeat
wait()
until GUI.Enabled == false
clickdetector.MaxActivationDistance = 15
playerFrame.Visible = true
v.Anchored = false
end
end
end)
And here are pictures of the error along with the playerGui folder

