local FlyGUI = "FlyGUI" if (game.Players.LocalPlayer.PlayerGui:GetChildren("FlyGUI") == nil) then if (game.Players.LocalPlayer.PlayerGui:GetChildren("FlyGUI") ~= nil) then game:GetService("ReplicatedStorage").FlyGUI:clone().Parent = game.Players.LocalPlayer.PlayerGui end end
Not exactly sure what I am doing wrong here.
There are a few errors in your code.. i'll walk you through them.
1) The GetChildren
function returns a table of the specified object's descendants. The function you're looking for is the FindFirstChild
function.
2) You have 2 contradicting if statements. You should omit the second one from your code
3) When you reference the 'FlyGUI', you should reference the actual object rather than a string representing the object. It saves you the need to search for the item.
local player = game.Players.LocalPlayer --Variable for the player local FlyGUI = game.ReplicatedStorage.FlyGui --Variable for the gui if not player.PlayerGui:FindFirstChild(FlyGUI.Name) then FlyGUI:Clone().Parent = player.PlayerGui --Clone gui to player end