Changing Gui's Parent To PlayerGui Is Not Working

Well I kept trying to let a GUI clone to PlayerGui to show itself up when an event happens,
but however when I run it in the studio it was not working, I checked for errors but there’s nothing wrong with the script. I also tried to look for solutions on hub in other people’s post, but there’s nothing about this situation.
Here’s My Script:

local ObjGui =  game.ReplicatedFirst.Objective.Objectives:Clone() 
ObjGui.Parent = game.Players.LocalPlayer.PlayerGui

As when I run the game at studio, it will show like this:

So what actually went wrong?

Or is there any other way to show it?

Any Reply Could Help Me Alot

1 Like

I don’t really work with cloning but did you try to parent it and not clone or is that not possible sorry if i’m wrong!

You can’t use LocalPlayer on Server-Side. You’ll have to use Remotes to achieve this.

Besides, server can’t really access PlayerGui because there were flaws (account stealers) so you’ll have to use a remote and fire client to open that UI.

2 Likes

Try this this will work cause it worked for me with a part to put it in the PlayerGui
But the only thing is that it will only add the part when a player joins i can’t find any other way

game.Players.PlayerAdded:Connect(function(plr)
	local Part = game.ReplicatedFirst.Objective.Objectives
	Part.Parent = plr.PlayerGui
end)

oh yeah it’s working properly, but this is more like when a player connected in a server and this will appear i quite want to know if it could be like after a event and then happens

With what do you want to trigger it to spawn into the Player Gui is it a button a touch or what is it so i can try it?

it will work like doing a button thing, but i wanted it to be triggered when like after some other commands like this

local time = 10
--here comes some scripts
wait(time)
--now it should be triggered

The problem is that you can’t do that you need to get the location from the player and that will be

	local plr = game.Players.LocalPlayer

The Problem is you can’t really do that cause it gives you an error so we need to add a button or something idk how but if we do

game.Players.PlayerAdded:Connect(function(plr)
end)

So what i did is get the player location by setting plr after the function it does the same but in an other way and that’s how my script work but i can’t find any other way possible but i hope i did help you a little bit.

Good luck!

1 Like

thank you ,this really worked for me when i tried to use remote event in order to clone it to the playergui, alot appreciate.