Cloning Gui from replicated first?

I want to clone my Gui from replicated first but it’s not working.
Here’s the code:

local RF = script.Parent -- Replicated First
local IO = RF.LocalScript.InsertedObjects -- ScreenGui
local L = IO.load -- Load Frame
local Txt = L.text -- Text for loading
local PS = game:GetService("Players") -- PlayerService
local TS = game:GetService("TweenService") -- TweenService

PS.PlayerAdded:Connect(function(player)
	local IOClone = IO:Clone()
	IOClone.Parent = player.PlayerGui
end)

I want to make a loading screen

Hi, I don’t see where you’re trying to get it from replicatedfirst.

Server Scripts only run if they’re inside the workspace, or ServerScriptService

If this is a LocalScript I believe you could easily do that by just defining the Player as a variable:

local Player = game.Players.LocalPlayer
local RF = script.Parent
local IO = RF.LocalScript.InsertedObjects
local L = IO.load
local Txt = L.text
local PS = game:GetService("Players")
local TS = game:GetService("TweenService")

local IOClone = IO:Clone()
IOClone.Parent = Player:WaitForChild("PlayerGui")

But this is in replicated first, and anything in it loads as quick as possible wouldn’t it yield if the player didnt join yet?

1 Like

This wouldn’t be the case if it’s a Server Script, you still need to acknowledge where they run & what type of script you need to insert

I hate this laptop it takes 50 hours to even type a single message

2 Likes