frame1 = script.Parent.Parent.Parent.Frame1 player = game.Players.LocalPlayer Job = script.Parent.Parent.Parent.Parent.Job.Frame script.Parent.MouseButton1Click:connect(function() player:WaitForChild('PlayerGui') frame1:remove() wait(5) game.Playergui.Job.Frame.Visible=true Job:clone().Parent = player.PlayerGui end)
Luckily, there appears to be a simple solution to this. game.PlayerGui does not exist. What you would need to access is game.StarterGui.
If your problem persists, I would double check that you are navigating the object library correctly. Things can easily get confusing with all of the .Parent's and it is easy to get lost. It has happened to me plenty of times.
frame1 = script.Parent.Parent.Parent.Frame1 player = game.Players.LocalPlayer Job = script.Parent.Parent.Parent.Parent.Job.Frame script.Parent.MouseButton1Click:Connect(function() player:WaitForChild('PlayerGui') frame1:Destroy() wait(5) Job.Frame.Visible=true -- if Job is a variable then you don't need anything before it. Job:Clone().Parent = player.PlayerGui end)
also like spyclub65 said, PlayerGui is not a member of game, rather the player. just in case, this should be a localscript inside a GUI inside of StarterGui
if you ever want to reference a player's GUI, use either script.Parent
or game.Players.LocalPlayer.PlayerGui
I've rewritten your script, here it is.
local frame1 = script.Parent.Parent.Parent.Frame1 local player = game.Players.LocalPlayer local job = script.Parent.Parent.Parent.Parent.Job.Frame script.Parent.MouseButton1Click:connect(function() player:WaitForChild('PlayerGui') frame1:Destroy() wait(5) player.PlayerGui.Job.Frame.Visible=true job:Clone().Parent = player.PlayerGui end)