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

Finding TextLabel in Player Gui, Only Works in Studio?

Asked by
Scootakip 299 Moderation Voter
8 years ago
gui = script.Parent.Parent.Rarity
function enter()
    gui.Visible=true
end
function leave()
    gui.Visible=false
end

script.Parent.MouseEnter:connect(enter)
script.Parent.MouseLeave:connect(leave)

This works in studio single player testing, but going onto a server gives an error on line 1 saying that Rarity is not part of the Frame it's in. Any help with this?

0
Is this a normal script and is filtering enabled on? M39a9am3R 3210 — 8y
0
It's a localscript with Filteringenabled off Scootakip 299 — 8y

1 answer

Log in to vote
1
Answered by 8 years ago
gui = script.Parent.Parent:WaitForChild("Rarity") --this has happened to me too, but adding "WaitForChild" will make the script wait until the object is loaded or found.
script.Parent.MouseEnter:connect(function() -- more efficient than the other method you were using.
    gui.Visible = true
end)
script.Parent.MouseLeave:connect(function()
    gui.Visible = false
end)
Ad

Answer this question