Help With PlayerGui function

heres my function

local function ShowGui(Player)
if Player:FindFirstChildOfClass("HumanoidRootPart") then
local frame = Player:FindFirstChild("PlayerGui").Shop.MenuFrame
frame.Visible = false
end

yeah, thats all I can come up with…

You forgot to close the function by adding another end

And besides that, what kind of help do you even need?

Do this:

local function ShowGui(Player)
if Player.Character:FindFirstChild("HumanoidRootPart") then
local frame = Player:FindFirstChild("PlayerGui").Shop.MenuFrame
frame.Visible = false
end

whoops, my bad.
I didn’t copy-and-paste correctly
(Didnt copy and paste the last end)

I tried @dutycall11 's code and it didn’t do anything, but stop my game

although something poped up in the middle of my output
ServerScriptService.GameScript:56: attempt to index nil with 'Character'

If this script runs before your character has loaded in it will produce nil for character children… so instead of FindFirstChild, use WaitForChild.

Your gonna have to provide more code for us to fix that

Now if I use WaitForChild it says to index nil with 'WaitForChild'

You have your script in ServerScriptService but this is a GUI and needs to be handled through local script. Place this in a local script inside the Gui.

Either that or you will have to fire a client event through the server script.

Make sure whatever UI you are trying to make visible is in starter gui, and then use this script:

local function ShowGui(player)
    if player:FindFirstChildOfClass("HumanoidRootPart") then 
        local frame = player.PlayerGui:FindFirstChild("Frame")
        frame.Visible = false
    end
end