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)

3 comments
PlayerGui isn't visible to the server or it hasn't loaded.
I think the error started at line 14.
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?