I am trying to make this "MapChooserGui" from Lighting clone into every player's PlayerGui, what I did was:
1 | local mapChooserGui = game.Lighting:FindFirstChild( "MapChooserGui" ):Clone() |
2 |
3 | for i,v in pairs (game.Players:GetPlayers()) do |
4 | mapChooserGui.Parent = v.PlayerGui |
5 | end |
This only works once somehow then when the game script repeats gives me this error in the output
The Parent property of MapChooserGui is locked, current parent: NULL, new parent PlayerGui
Someone help me please!
As GoldenPhysics said, you have to make multiple clones: one for each Player.
1 | local mapChooserGui = game.Lighting:FindFirstChild( "MapChooserGui" ) |
2 |
3 | for _, v in pairs (game.Players:GetPlayers()) do --We never use 'i', so I marked it as such. |
4 | mapChooserGui:Clone().Parent = v.PlayerGui --I moved the 'Clone' call to here, so it makes a new clone for each Player. |
5 | end |
I would have it in a frame, in the players backpack, then have a local script that is on a loop, and the waittime before it activates the frme to appear again is the length per round. such as this:
1 | while true do |
2 | wait(enter round time here plus 1 or something) |
3 | mapchooser = script.Parent.mapchoosergui.MapChooserGuiFrame |
4 | mapchooser.Visible = true |
5 | wait(time you want it to appear) |
6 | mapchooser.Visible = false |
7 | end |