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

[SOLVED] ScreenGui not cloning in ServerStorage, What am I doing wrong?

Asked by 2 years ago
Edited 2 years ago

I recently just started scripting and I made a inventory, However it was in the way of other things so I put it into the ServerStorage.. I am trying to make it if you were to join the game the Gui clones and parents it into StarterGui so it is there when you join the game. I have been working on it for like 2 hours and no luck, I have looked at a bunch of tutorials, but all of them were not for gui's, heres my code:

local gui = script.Parent

local ClonedGui = gui:Clone() ClonedGui.Parent = game.StarterGui

(The type of script is a normal script)

1 answer

Log in to vote
0
Answered by 2 years ago

All instances of StarterGui will be reparented into PlayerGui. (It's a child of a player instance.) All of the Gui will be displayed there as well. Try doing this instead:

local gui = script.Parent

game.Players.PlayerAdded:Connect(function(plr)
    local ClonedGui = gui:Clone()
    ClonedGui.Parent = plr.PlayerGui
end)

Quick question, why did you place your script inside of the Gui?

0
Thanks and I just started scripting so I kind of just assumed to put it there lol. FlyingTurtlePony 2 — 2y
Ad

Answer this question