I'm trying to create a party request script but whenever i run the script. it says that "PlayerGui" isn't a member of "Player". if somebody can help i'd really appreciate it . Thx :D
Button = script.Parent Button.MouseButton1Down:connect(function() local PName = script.Parent.Parent.PlayerName local Player = game.Players[PName.Value] local You = game.Players.LocalPlayer script.Parent.Parent.Visible = false if not Player.PlayerGui:FindFirstChild("Invite") then local gui = script.Invite:clone() gui.Parent = Player.PlayerGui gui.PlayerName.Value = PName.Value gui.InviterName.Value = You.Name gui.Frame.Visible = true gui.Frame.lblText.Text = "Invite from ".. You.Name end end)
If your game is FilteringEnabled
, you cannot access another player's PlayerGui
locally through a LocalScript
.
What I would recommend you to do is to keep up with parties (like who's in a party, maximum amount of people, etc.) with StringValue
objects and other objects such as Folder
s and IntValue
s (or whatever else you for providing information of a party in a GUI) inside of Workspace
.
You have to use RemoteFunction
s and RemoteEvent
s (here's the wiki page) accordingly to talk to Workspace
(such as when you want to add a person to a party when he/she clicks a specific GUI).
However, you DON'T need to use RemoteFunction
s or RemoteEvent
s when you just want to read a value. For example, if you have a StringValue
named "PlayerName" inside a party Folder
called "Party1" in Workspace
, you can just do this from the client to retrieve the player's name:
local name = game.Workspace.Party1.PlayerName.Value
Hope this helps!