✓ Accepted answer
#Answer:
Step-By-Step explanation
##What does this error mean?
The error message attempt to index nil, means that you've attempted to index something that does not exist in the workspace. In this case it's the player.
Quick Tip: Errors are usually very easy to deal with, just follow what the error code says and the make some refinements, IF there's no errors obviously try and find out what's wrong with the script, you can do this by using the function print() (again as stated, if there's no errors enumerated above).
If you'd like, you can visit this article to learn about prints and strings to help you proofread your script by clicking on the hyperlinks, or you can watch a short video by ROBLOX themselves on how to use prints for debugging.
##How can this be resolved
You simply have to define/reference the local player!
##Fixed Script
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
script.Parent.Parent.v4.Visible = true
player.PlayerGui.ScreenGui.a1.Visible = false
player.PlayerGui.ScreenGui.a2.Visible = false
player.PlayerGui.ScreenGui.a3.Visible = false
player.PlayerGui.ScreenGui.a4.Visible = false
player.PlayerGui.ScreenGui.q.Visible = false
player.PlayerGui.ScreenGui.w.Visible = false
player.PlayerGui.ScreenGui.y.Visible = false
player.PlayerGui.ScreenGui.z.Visible = false
end)
This should fix your issue!
####Re-edited by JesseSong!
If you have any further enquiries don't hesitate to comment!
1 comment
Please format your code correctly, it's so much easier to read then