I cannot seem to figure out how to basically swap My character with another without having to clone him. I just need help figuring it out if possible
This is the roblox apporived way of doing this
local newChar = "model containing Humanoid and all that stuff"
local plr = "the player object you are changing"
local charClone = newChar:Clone()
charClone.Name = plr.Name
plr.Character = charClone
charClone.Parent = workspace
You could just have a folder containing the hats and whatever, then when they’re needed remove the player’s present accessories and put the new ones on.
I really want to make it so that I can “Swap out” the character for a rig, without effecting the normal character - such as the players backpack, which resets each time - Something that would be reversible
robloxapp-20250129-0203527.wmv (2.0 MB)
– Like this just without all of the bugs –
Well just add a clone of your original character and put it in the backpack, and whenever you want to go back you just use that one…
local plr = "the player object you are changing"
local function changeCharacterToModel(plr,newCharacterModel)
--make a copy of your current character
local oldChar = plr.Character
local originalAvatarClone = oldChar:Clone()
originalAvatarClone.Name = "OriginalAvatar"
originalAvatarClone.Parent = "folder maybe in players backpack"
--now replace the old character with the new one
local charClone = newCharacterModel:Clone()
charClone.Name = plr.Name
plr.Character = charClone
charClone.Parent = workspace
end
local function changeCharacterToSavedAvatar(plr)
--check if there is an original avatar in storage
if [foler wher you placed it].OriginalAvatar then
--now replace the old character with the new one
local charClone = [folder where you placed this].OriginalAvatar
charClone.Name = plr.Name
plr.Character = charClone
charClone.Parent = workspace
end
end
As for the backpack thing you can just clone the contense and move it over. If things like ammo count ans stuff arent preserve. move the ammo count from insde the tool script to a Value instance. as the internal state of scripts cannot be cloned, but if dependant variables are held in value instances then they can be.
This was good man, Thanks for the help!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.