Basic Scripting Help

Hello,

I am attempting to create a block that when clicked by the player a GUI appears. However, as simple as it is I cant seem to get it to work. When the block is clicked nothing appears and no error occurs in the output window either. I know whatever im missing has to be something really minor but I cant seem to pinpoint it and am needing others perspective.

I have tried adding in :WaitForChild(), I’ve tried taking the script out of the click detector and placing it in the brick while changing the connection line to script.Parent.ClickDetector.MouseClick:Connect(click) with no luck.

So, here is my script:

local function click(player)

player.PlayerGui.NewPatient.Frame.Visible = true

end

script.Parent.MouseClick:Connect(click)

2 Likes

You need to move this from a script to a local script, place it in PlayerGui (under your GUI), and change the frames visibility by detecting the workspace mouse click.

EDIT: Sorry if this is unclear, I’m on mobile right now.

1 Like

I just tried your script with a server script under the click detector, and it works fine:

Under workspace:
image

image

What went wrong?

1 Like

I was using a local script, so they may have been the problem. I did what @snorebear suggested and it works fine now.

3 Likes