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

Why can't I interact with buttons outside a frame? (screenshot included)

Asked by 1 year ago
Edited 1 year ago
invis = -- i can't find the button i want to make invisible
script.Parent.MouseButton1Click:connect(function()
    invis.Visible = false
end)

https://imgur.com/a/2Le7x8d

1 answer

Log in to vote
1
Answered by
SuperPuiu 497 Moderation Voter
1 year ago
Edited 1 year ago

Hello!

The instance looks like it's a child of Frame isn't it?

invis = script.Parent.Parent["Enter here the name of the button"] -- replace the text that's in "" with the button name
script.Parent.MouseButton1Click:connect(function()
    invis.Visible = false
end)

If it is a child of StarterGui then:

invis = script.Parent.Parent.Parent["Enter here the name of the button"] -- replace the text that's in "" with the button name
script.Parent.MouseButton1Click:connect(function()
    invis.Visible = false
end)

See what I did? I 'jumped' from parent to parent to the Parent where the button is.

Ad

Answer this question