Here is my code..
game.Players.PlayerAdded:connect(function(player) local Script = Instance.new("Script", game.Workspace) Script.Name = player.Name end)
But i need some help, i do not understand how i can write code for the script that will accure in Workspace. I need to put some code inside the script. Can someone help me?
And i also wonder if there is any smarter way to place the script. It does only need to be running for the client and it can not be recreated in death. So not inside the StarterGUI or StarterPack. Please help anyone :-)
There is no way to do this with a normal or local script, sadly. But there are some work-arounds!
One of the work arounds is to have the script pre-made and then place that script somewhere, anywhere you'd prefer, and then set it's Disabled property to true. When you need the script, clone it and place it where it needs to be, then set it's Disabled property to false.
The other way is to have a script or local script, said script should be Disabled, with the following inside of it:
loadstring(script.Src.Value)()
The script should also have a StringValue, in this case named "Src", inside of it. When you want to use the script, clone it. Then change the StringValue's Value to the source you want to run. After that, place it and set Disabled to false.
There is no way to edit a code of a script outside of Edit mode. I would crate the script, put in the code you want, and make it disabled.
Then use something like;
game.Players.PlayerAdded:connect(function(player) local ScriptC = script.SCRIPT_NAME:Clone() ScriptC.Parent = script ScriptC.Name = player.Name ScriptC.Disabled = false end)