``I've been trying to Change Visible on a Frame when a player touches a part but its giving me this error and i don't know why.
The Error
Workspace.DetectPart.OpenScript:10: attempt to index local 'EnableShop' (a nil value)
the script is a global script
here is my script
script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid")and game.Players:GetPlayerFromCharacter(hit.Parent) then
local player = game.Players:GetPlayerFromCharacter(hit.parent)
if player.OnPart.Value == false then
player.OnPart.Value = true
local EnableShop = player.PlayerGui:FindFirstChild("EnableShop")
EnableShop.Frame.Visible = true
end
end
end)
I've tried many different ways and i cant figure it out :(

5 comments
"global script"
its a global scipt
What's OnPart?
its a Bool Value inside player so that the script only hapens once
Oh you can make that a normal variable in the script like, noSpam = false