What is the best way to use ReplicatedFirst and PlayerScripts?


Desired Outcome

To be more specific, I want to insert stuff into a folder that’s inside one of the players ReplicatedFirst/PlayerScripts.


Error

I try doing this, and although it’s not there on the client and I’m reading for the client side; it says the item is still there… what do I do to fix this?

I clone a localscript from the ReplicatedStorage/ReplicatedFirst to insert it into the ReplicatedFirst/PlayerScripts folder.

If you want the script(s), here ya go;


Scripts

Local Script that checks if theirs a local script inside the 'Cutscenes' Folder.
repeat
	if game.ReplicatedStorage.ReplicatedFirst_J2T:FindFirstChild("Cutscene_Control") then
		for i,Cutscene in pairs (game.ReplicatedStorage.ReplicatedFirst_J2T.Cutscene_Control:GetChildren()) do
			if game.ReplicatedFirst.Cutscenes:FindFirstChildWhichIsA("LocalScript") and not game.ReplicatedFirst.Cutscenes:FindFirstChild(Cutscene.Name) then
				game.ReplicatedFirst.Cutscenes:ClearAllChildren()
				local CutsceneClone = Cutscene:Clone()
				CutsceneClone.Parent = game.ReplicatedFirst.Cutscenes
				CutsceneClone.Disabled = false
				print("Ran")
			else
				warn(game.ReplicatedFirst.Cutscenes.Name.." still has the ".. Cutscene.Name.. " inside the Folder!")
			end
		end
	end
	wait(.05)
until script.Disabled == true
The Remote Event Script that clones the local script to a storage container of my choosing.
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr)
	script.ree:Clone().Parent = game.ReplicatedFirst.ReplicatedFirst_J2T.Cutscene_Control
	wait(5)
	game.ReplicatedFirst.ReplicatedFirst_J2T.Cutscene_Control["ree"]:Destroy()
end)

Also, just so it’s clear; I just fire a remote event through a TextButton being clicked.


Thank you for any assistance you may provide.

1 Like

tossing a bump here to try and get some assistance.

Scripts on StarterPlayerScripts goes to the player when the player joins for example:

local player = script.Parent.Parent or game.Players.CoolName099

And on StarterCharacter, the script goes to the player on workspace like:

local Player = script.Parent or game.Workspace.CoolName099

i dont know what you are to do but heres a tip


Answer(s)

ReplicatedScriptService

DO NOT USE ReplicatedScriptService. Roblox has cut all support of the Service and anything that’s a child of the said service will be lost when Roblox eventually removes the service entirely.

ReplicatedFirst

ReplicatedFirst is used to have local scripts run on start; usually for game loading UIs. I don’t know much else about it so… do research before using the service.

StarterPlayerScripts

The PlayerScripts folder is the local Folder Container inside each player when they load into the game. It is loaded on the clients end, so the server will not be able to access that Folder at all.

The way to have the game/server add stuff to this folder when a player joins your game is to add it to StarterPlayerScripts, which is the Server Container for this Folder. Now, due to it being on the server and not being client exclusive; anything you try to add to that folder will be added to anyone who joins the game.

StarterCharacterScripts

The StarterCharacterScripts is the container to add scripts to the Players Character when they load into the game.