I made an updater for one of my projects.
this object requires a local script off the toolbox. and I want to put the script inside “StarterPlayerScripts”
however, by the time it is done the first player has already loaded in.
I tryed
local Players = game:GetService("Players")
for i,v in pairs(game:GetService("Players"):GetChildren())do
v:LoadCharacter()
end
is there any way of reloading the player totaly (including StarterPlayerScripts)
Are you sure the local script is in StarterPlayerScripts and your changes are published? Because the only reason the local script wouldn’t automatically be added is if you’re adding it to StarterPlayerScripts after runtime.
You shouldn’t need to use TeleportService.
If the above is true, please send a place file as I’m curious as to why you’d have this behavior.
I require a local script off the toolbox (or library). by the time the script is in the game, the player has already been loaded.
then it is put into StarterPlayerScripts, but remember the player has already been loaded in.
using teleport service the player reconect. and it refreshes the playerscript folder.
so far i ahvent found a better way
One solution could be cloning the required local script into something like ReplicatedStorage, and then have a different local script in StarterPlayerScripts wait for it, then clone it into it’s parent, which would be the PlayerScripts (since the game is now running).
For example:
--A server script
local someToolboxAsset = --Get the toolbox item
someToolboxAsset.Parent = game:GetService('ReplicatedStorage')
--A local script in StarterPlayerScripts
local toolboxAsset = game:GetService('ReplicatedStorage'):WaitForChild(nameOfToolboxAsset)
toolboxAsset.Parent = script.Parent
you cant acces PlayerScripts from the server.
only way to do that is to put it inside of the playergui, that resets everytime a new character is spawned.
what you describe is posible, but i prefer to do it from the server,
Then you might be out of luck. The only way to accomplish what you want is to have the server make the resources available to the client, and have the client clone them to their client-only destination.
There is a hack regarding using ScreenGuis with ResetOnSpawn set to false and putting the contents in one and parenting it to their PlayerGui, but that’s even more work than the original suggested idea.
Your best solution is the one I already described, though feel free to use some other hacky method instead.