@NotWhutThe is probably correct then, why do you want to put the characters in a folder?
Again, I want test something. Please dont discuss about what I do need and what not. If you want help me then help. If you want discuss - what I do need - then this is the wrong comment section for you.
Never use while true do
loops like that, itās unnecessary when weāre waiting for an event (In this case, players added), all it does now is cause tremendous lag.
Maybe you can add object values to a folder instead of the character?
local Players = game:GetService("Players")
local Folder = workspace:WaitForChild("npc_directory")
Players.PlayerAdded:Connect(function(Player)
local Value = Instance.new("ObjectValue",Folder)
Value.Value = Player
Value.Name = Player.Name
end)
Hello there! I have made a working script for you.
- Your Explorer menu must look like this;
-
Put this script into āServerScriptServiceā.
local Players = game:GetService("Players") Players.PlayerAdded:Connect(function(plrAdded) -- It checks if a player joined the game. plrAdded.CharacterAdded:Connect(function(charAdded) -- It checks if a player's character joined the game. wait(1) -- If you don't add this, it won't work. local PlayerCheck = Players:GetPlayerFromCharacter(charAdded) -- Gets player from the character local Model = game.Workspace:FindFirstChildWhichIsA("Model") -- Checks if the class name is "Model" local ModelName = Model.Name if ModelName == PlayerCheck.Name then Model.Parent = game.Workspace.npc_directory -- Puts the model into the folder end end) end)
-
Here is how it works:
EDIT: You donāt need to use Clone()
function or donāt need to create a value using Instance.new
This is the simplest way that you can use.
game:GetService("Players").PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
repeat game:GetService("RunService").Heartbeat:Wait() until character:IsDescendantOf(workspace)
character.Archivable = true
character.Parent = workspace.npc_directory
end)
end)
this should work
give someone the soulituonnnnnn
just add wait before changing a parent , hereās code sample :
game.Players.PlayerAdded:Connect(function(player: Player)
player.CharacterAdded:Connect(function(character: Model)
task.wait(1) --The solution
character.Parent = --Folder where player should be
end)
end)
That was three years ago when I didnāt know how to script, but thanks.