Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

attempt to index nil with 'Visible'?

Asked by 3 years ago

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

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

Answer this question