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

ASGP is not a valid member of PlayerGui?

Asked by 4 years ago

I don't know whats wrong. I look in PlayerGui, and the ScreenGui named "ASGP" is definitely there. Need help.

Code is in a Local Script

local frame = script.Parent.Parent.Parent.Parent.ASGP.Frame --game.StarterGui.ASGP.Frame

script.Parent.MouseButton1Click:connect(function()
    frame.Visible = true
end)

1 answer

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

Hello Tyler i'm here to help you. The best is use a «service» to find anything on a PlayerGui.

local Players = game:GetService('Players') 

>

local Player = Players.LocalPlayer
local PlayerGui = Player :WaitForChild('PlayerGui') -- WaitForChild is really important when you search anything on a UI

>

local ScreenGui = PlayerGui:WaitForChild('ASGP')
local frame = ScreenGui:WaitForChild('Frame')

script.Parent.MouseButton1Click:connect(function()
    frame.Visible = true
end)

You can make it too

script.Parent.MouseButton1Click:connect(function()
    game:GetService('Players').LocalPlayer:WaitForChild('PlayerGui '):WaitForChild('ASGP'):WaitForChild('frame').Visible = true
end)
1
Thank you so much. Tyler090130 619 — 4y
Ad

Answer this question