Click To Show GUI Not Working

So I don’t really like the regular Roblox Studio Dialogue feature look so I wanted to make my own Dialogue GUI So I placed an NPC then made a wall in front of it then unchecked CanCollide then set the Transparency to 1 so players don’t see it. Then I put a ClickDetector and a LocalScript and in the local script I wrote:

function OnClick()
script.Parent.Parent.Parent.StarterGui.ScreenGui.Frame.Visible = true
print("Someone Is Talking to the NPC!")

end

script.Parent.ClickDetector.MouseClick:Connect(OnClick)

Then It did not work, Please keep in mind that I am not that good with scripting, I only have about 4 months of experience with scripting.

Pictures explaining my issue:
Screenshot_23


Put the LocalScript inside of the Gui. Handle the click from there

local part = workspace.Part -- or where ever the part is

part.ClickDetector.MouseClick:Connect(function()
    script.Parent.Frame.Visible = true
end)
1 Like

Do I put it inside The Frame or ScreenGui?

It doesn’t necessarily matter as long as your variables reference the correct objects, but its better to put the LocalScript directly into the ScreenGui.