This is the code:

script.Parent.MouseButton1Click:connect(function()
    local plr = game:GetService("Players").LocalPlayer
    plr.PlayerGui.ScreenGui.Frame1.Visible = true
end)

It works well in studio but it does not work in game.

The error says: Workspace.MainSreen.SurfaceGui.HackButton.Script:3: attempt to index local 'plr' (a nil value)

Can anyone help? Thank you!

This is inside a normal script, which is inside a SurfaceGui TextButton.

If you would like to contact me to go check it out in team create, please tell me.

4 comments

0

You need to put it in a local script as it is handling guis. Unless you want to use remote event

0

Okay I will try that.

0

Did it work?

0

No it didn't. If you would like, I could invite you to a team create to check it out.