Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to use the clone a value into a player when they join the game?

Asked by 4 years ago

I am trying to make it so that when a player joins the game a value gets cloned into their playergui but I can't seem to do it. Could someone help? Thanks!

1local clone = game.ServerStorage.canuseresearch:Clone()
2 
3game.Players.PlayerAdded:Connect(function(player)
4    wait(1)
5    print(player.Name .. " joined the game!")
6    clone.Parent = game.Players[player.Name].PlayerGui.ScreenGui
7end)
0
Also you can just place a value inside ScreenGui and it will go into the playergui brodywth 97 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

Place Inside workspace btw it takes 1.2 seconds for all scripts to load in, any time you are defining a new child which in this case is ScreenGUI. always add a wait for 1.2 seconds

1local a=game.ServerStorage.canuseresearch:Clone()
2 
3game.Players.PlayerAdded:Connect(function(plr)
4 
5    wait(1.2)
6    print(plr.Name .. " joined the game!")
7 
8    a.Parent = plr.PlayerGui.ScreenGui
9end)
0
also its easier to just define by finding who set off the function, instead of defining who set off the function then searching for it. brodywth 97 — 4y
0
Thank you so much it worked and it is helping so much! Thank you! kavancraft59 11 — 4y
0
Your welcome brodywth 97 — 4y
Ad

Answer this question