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

Attempting to access a PlayerGui, but it errors?

Asked by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
9 years ago

Hey all! So, my script works fine, except for line 20, when I attempt to access "Victim"'s PlayerGui. "Victim" is the Player of the character I click with my mouse. It keeps saying "PlayerGui" isn't a valid member of "Player", and whenever I put WaitForChild, or repeat wait(), it still says the same error. Any tips? Thanks!

repeat wait() until script.Parent.Parent.Name~="Backpack"
wait()

tool = script.Parent
Citation = game.Lighting.CitationsDB
Player = game.Players.LocalPlayer

tool.Equipped:connect(function(mouse)
    if not Player:findFirstChild("PlayerGui") then return end
    if Player.PlayerGui:findFirstChild("CitationsDB") then return end
    mouse.Button1Down:connect(function()
        if mouse.Target then
            if game.Players:GetPlayerFromCharacter(mouse.Target.Parent) then
                local Victim = game.Players:GetPlayerFromCharacter(mouse.Target.Parent)
                Citation:clone().Parent = Player.PlayerGui
                local GUI = Player.PlayerGui.CitationsDB
                GUI.CitationsDB:TweenPosition(UDim2.new(0.5,-160,0.5,-100),'Out','Quad',0.35)
                GUI.Citee.Value = Victim.Name
                GUI.CitationsDB.Citation.Username.Text = "Username: "..Victim.Name
                Victim.PlayerGui.ScreenGui:Destroy()
            end
        end
    end)
end)
0
PlayerGui isn't visible to the server or it hasn't loaded. LegitimatlyMe 519 — 9y
0
I think the error started at line 14. woodengop 1134 — 9y
0
It has loaded, because the person I'm trying to access their GUI, they have all of their GUIs set. @TheContinetofEurope How could I fix that? Shawnyg 4330 — 9y

1 answer

Log in to vote
-1
Answered by 9 years ago

Just use game.StarterGui:SetCoreGuiEnabled and disable the cores using this code.

game.StarterGui:SetCoreGuiEnabled("Chat","PlayerList",Health")
--It might not work with the multi-syntax.
-- Just do it one by one.

1
How does this relate to Accessing the PlayerGui? woodengop 1134 — 9y
0
Yeah... Nice try, though.. Shawnyg 4330 — 9y
0
Ah, you meant the actual StarterGui? Control22 5 — 9y
Ad

Answer this question