What do I want to achieve - In this code, I’m trying to make a function in a server-script that finds a Frame that is named after the Player. The Frame gets cloned and parented into a folder inside of a Gui
What’s the issue - Every time I execute the function in the script I get an error message that says
--Ministry_Ray21 is not a valid member of Folder "Players.Ministry_Ray21.PlayerGui.TeleportMenu.InParty.Frame.PlayersInfo" - Server - Queue:28
What solutions have I tried - I’ve tried rewriting this function multiple times, but nothing I do has worked yet
– Btw this is my first post so sorry if anything is incorrectly formatted
If someone could help me out with this script that would be great
Here is the full code for the function
function GetInfo(Plr : Player)
local TeleportMenu = Plr.PlayerGui.TeleportMenu
local PlayerInfoClone = TeleportMenu.InParty.Frame.PlayersInfo:FindFirstChild(Plr.Name)
wait(1)
if Plr.DisplayName == Plr.Name then
PlayerInfoClone.NameLabel.Text = "@"..Plr.Name
elseif Plr.DisplayName ~= Plr.Name then
Plr.PlayerGui.TeleportMenu.InParty.Frame.PlayersInfo[Plr.Name].NameLabel.Text = "@"..Plr.DisplayName -- This is where I get the error
local Image = game.Players:GetUserThumbnailAsync(Plr.UserId,Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)
PlayerInfoClone.PlayerImage.Image = Image
print("Worked")
return Image
end
end
isnt errors telling what is the problem?
This GUI objects doesnt exists. PlayersInfo[Plr.Name] or it doesnt have player’s name.
Regardless i dont understand why are you putting wait here anyway …
use WaitForChild for the children in your PlayerInfoClone variable, its not recommended to use FindFirstChild unless your code can be absolutely sure that the instance has been loaded by the client already.
i.e. local PlayerInfoClone = TeleportMenu:WaitForChild("InParty"):WaitForChild("Frame")...
Yes but I haven’t been able to figure out how to fix the problem. The wait is there because it previously was running the function before the frame cloned so I added a wait but it still is not being detected. I even tried to name the Frame something else and its still not being detected.
Okay I think I figured out what’s the issue. Since I use a local script for the cloning part, the server doesn’t detect the cloned Frame inside of the Player’s Gui so it’s only visible for the current client. I think I’m going to try to rescript the cloning script onto the server script.
I figured out the solution. I forgot to mention originally that I scripted the part where the Frame gets cloned through a local-script and connected it to the server-script with a remote event. This was making it so the Frame could only be accessed on the client, not the server so that’s why the Frame wasn’t being detected. Thank you for the help guys.