I was wondering how I could create a copy (or multiple) copy(ies) of a player in-game. I at first thought that I could change the humanoid’s CharacterAppearanceId, but then I realized that that only exists in players. The thing is, I can’t add a player either (because of privacy issues) How would I make clones like Clone Tycoon 2 did for their arena?
16 Likes
You need to enable the Archivable property.
local playerToClone = ""
function CloneMe(char) --a function that clones a player
char.Archivable = true
local clone = char:Clone()
char.Archivable = false
return clone
end
local charClone = CloneMe(game.Players[playerToClone].Character) --connects function and defines "charClone" as the result of the function
charClone.Parent = game.Workspace
45 Likes
I haven’t played Clone Tycoon, but I assume you’re talking about multiple characters of the same player.
You could use the Archivable
property of the player’s character (which’s false by default) and set it to true, then call Character:Clone()
to clone the character, set the property back to false, do what you need to do with the clone, and wa-la - you have a clone.
5 Likes
@TheeDeathCaster @alxzile So now I have a clone type checker that’s printing TwoNormal, and then a server script that’s receiving that same variable and changing it to Derpee_Kirbee. Can one of you explain this?
Local Script
game.ReplicatedStorage:WaitForChild("GameState").Changed:Connect(function()
if game.ReplicatedStorage.GameState.Value == "Intermission" then
script.Parent.Visible = true
else
script.Parent.Visible=false
end
end)
local descendants = script.Parent:GetDescendants()
for x=1, #descendants, 1 do
local descendant = descendants[x]
if descendant:IsA("TextButton") and descendant.Name == "ClickBox" then
descendant.MouseButton1Click:Connect(function()
local cloneType = descendant.Parent.Name
print(cloneType)
local remoteEvent = game.ReplicatedStorage:WaitForChild("CloneTypeEvent")
remoteEvent:FireServer(cloneType)
script.Parent.Visible=false
end)
end
end
Server Script
game.Players.PlayerAdded:Connect(function(player)
local gameState = game.ReplicatedStorage:WaitForChild("GameState")
gameState.Changed:Connect(function()
if gameState.Value == "Intermission" then
game.ReplicatedStorage:WaitForChild("CloneTypeEvent").OnServerEvent:Connect(function(cloneType)
_G.CloneType = cloneType
end)
for x=10, 0, -1 do
if x <= 0 then
gameState.Value = "InGame"
end
local remoteEvent = game.ReplicatedStorage:WaitForChild("TimeUntilNextGameEvent")
remoteEvent:FireClient(player,x)
wait(1)
end
end
if gameState.Value == "InGame" then
print("In Game")
print(_G.CloneType)
if _G.CloneType == "TwoNormal" then
print("2 normal clones being made")
repeat wait() until player.Character ~= nil
player.Character.Archivable = true
for x=1, 2, 1 do
local clone = player.Character:Clone()
clone.Parent = workspace
clone.Name = player.Name .. " Clone"
end
end
end
end)
end)
4 Likes