So i maked a script for clone the player, but is give me error, i try to use WaitForChild but not work, after i try to copy the player and past it in workspace and is work but if i try to direct copy the player skin is give me error
sender = player object
commands.clone = function(sender, arguments)
if isAdmin(sender) then
local playerToClone = arguments[1]
if playerToClone then
local Plr = findPlayer(playerToClone)
if Plr then
local PlrChar = game.Workspace[Plr.Name]:Clone()
PlrChar.Parent = game.Workspace
end
end
end
end
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.
isAdmin verify in a list if user is admin and return true or false
arguments is arguments with the command for the exemple now the arguments 1 is the player name
--Functions
local function isAdmin(player)-- Need Player Object
for _, v in pairs(admins) do
if v == player.UserId then
return true
end
end
return false
end
local function isAdminWithID(userID)-- Need Player ID
for _, v in pairs(admins) do
if v == userID then
return true
end
end
return false
end
local function findPlayer(name)
for i, player in pairs(game.Players:GetPlayers()) do
if string.lower(player.Name) == name then
return player -- Return the player Object
end
end
return nil
end
This is happening because, by default, Roblox sets the Archivable property of the character model to false. Archivable determines if something can be cloned and if it can be saved. Because Archivable is set to false Instance:Clone returns nil.
Before cloning, do
Plr.Character.Archivable = true
And yeah don’t do workspace[player.Name] because it can interfere with other instances that coincidentially have the same name as a player. And because that is reinventing the wheel and there is no reason to reinvent the wheel.