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

[SOLVED] How can I clone a GUI from Serverstorage into StarterGUI?

Asked by 5 years ago
Edited 5 years ago

I'm trying to create a fast travel map, but the GUI won't copy over. I tried with both local scripts and normal scripts. I tried moving it to ReplicationStorage and trying both Local and normal and it still doesn't work! Help please!

local player = game:GetService("Players").LocalPlayer
local points = game.Workspace.PlacePoints
local ui = game.ReplicatedStorage.INFOUI
local loc = ui.UI.Frame.LOCA
local info = ui.UI.Frame.INFO
local newui = ui:Clone()

function onClicked()
    newui.Parent = player.StarterGUI
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)
0
Cloning something to the StarterGui won't change any thing on the player's side, try parenting it to the PlayerGui mixgingengerina10 223 — 5y
0
and I think you can't clone something from the serverstorage using local scripts mixgingengerina10 223 — 5y
0
Here, use a normal script and write the following:local points = game.Workspace.PlacePoints local ui = game.ReplicatedStorage.INFOUI local loc = ui.UI.Frame.LOCA local info = ui.UI.Frame.INFO local newui = ui:Clone() function onClicked(Player) newui.Parent = Player.PlayerGui end script.Parent.ClickDetector.MouseClick:Connect(onClicked) mixgingengerina10 223 — 5y
0
That worked! Thank you so much!!!!! Crusadious -6 — 5y
View all comments (2 more)
0
Make sure to edit your question's title with "[SOLVED]" so people know it had been solved. User#19524 175 — 5y
0
Thank you, I'll do that. Crusadious -6 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

The StarterGui is a service which will clone their contents into the respective player's PlayerGui once they join. When an object is added mid-game, it will not work immediately. When a player resets though, it will be cloned again. So you must use PlayerGui instead of StarterGui. Also, connect is deprecated. Please use Connect.

local player = game:GetService("Players").LocalPlayer
local points = game.Workspace.PlacePoints
local ui = game.ReplicatedStorage.INFOUI
local loc = ui.UI.Frame.LOCA
local info = ui.UI.Frame.INFO
local newui = ui:Clone()

function onClicked()
    newui.Parent = player.PlayerGui
end

script.Parent.ClickDetector.MouseClick:Connect(onClicked)
Ad

Answer this question