Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

GUI, giver doesn't work.. the script doesn't give the localplayer the gui?

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)

1 comment

0

Could you please Code Block that script

3 answers

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.

1 comment

0

No. StarterGui is the guis that all players spawn with. Use PlayerGui under Player module.

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)


1 comment

0

Remember, this would not be FE friendly.

This discussion is preserved as it was. New answers, comments, and votes are closed.