when i wrote this line of code which make sure player owns a gamepass to make the button visible in the output it says "attempt to index nil with 'Visible'" please help
local mps = game:GetService("MarketplaceService")
local player = game.Players.LocalPlayer
if mps:UserOwnsGamePassAsync(player.UserId, 18392789) then
script.Parent.Visible = true
end
script.Parent.MouseButton1Click:Connect(function()
player.Character.Humanoid.WalkSpeed = 16
script.Parent.Visible = false
script.Parent.Parent.Off.Visible = true
end)
line 4 btw

8 comments
At least try to interpret your error message, yes? You attempted to index (set something's property) with Visible, but, that "something" was missing.
Usually that happens a lot with localscripts, so I recommend using :WaitForChild()
wait a second how can a script.parent be missing
still doesnt work
im just confused how can a script.parent be missing
is script.Parent the button? or something else
In this case, you might want to show the explorer
script.parent is the button