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)
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)