I want players to be able to change their rigtype (r6 and r15) without going to the roblox avatar and resetting in game..is that possible? i tried a simple chatted event and used _G variables but when i want to change to r6, everytime i respawn i die again. help?
chatted script in serverscriptservice:
_G.r6 = false
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
if string.lower(msg) == "/r6" then
_G.r6 = true
elseif string.lower(msg) == "/r15" then
_G.r6 = false
end
end)
end)
changeRig script in startercharacterscripts:
while wait() do
if _G.r6 == false and script.Parent.Parent.Parent.Humanoid.RigType == Enum.HumanoidRigType.R6 then
script.Parent.Parent.Parent.Humanoid.RigType = Enum.HumanoidRigType.R15
elseif _G.r6 == true and script.Parent.Parent.Parent.Humanoid.RigType == Enum.HumanoidRigType.R15 then
script.Parent.Parent.Parent.Humanoid.RigType = Enum.HumanoidRigType.R6
end
end
updated:
while wait() do
if _G.r6 == false and script.Parent.Humanoid.RigType == Enum.HumanoidRigType.R6 then
local pastChar = script.Parent
pastChar.Archivable = true
local newChar = pastChar:Clone()
newChar.Parent = workspace
newChar.Humanoid.RigType = Enum.HumanoidRigType.R15
local description = game.Players:GetHumanoidDescriptionFromUserId(game.Players:GetPlayerFromCharacter(script.Parent).UserId)
newChar.Humanoid:ApplyDescription(description)
repeat wait() until game.Players:GetPlayerFromCharacter(script.Parent)
game.Players:GetPlayerFromCharacter(script.Parent).Character = newChar
game.Players:GetPlayerFromCharacter(script.Parent).Camera.CameraSubject = newChar.Humanoid
game.Players:GetPlayerFromCharacter(script.Parent):LoadCharacter()
elseif _G.r6 == true and script.Parent.Humanoid.RigType == Enum.HumanoidRigType.R15 then
local pastChar = script.Parent
pastChar.Archivable = true
local newChar = pastChar:Clone()
newChar.Parent = workspace
newChar.Humanoid.RigType = Enum.HumanoidRigType.R6
local description = game.Players:GetHumanoidDescriptionFromUserId(game.Players:GetPlayerFromCharacter(script.Parent).UserId)
newChar.Humanoid:ApplyDescription(description)
game.Players:GetPlayerFromCharacter(script.Parent).Character = newChar
repeat wait() until game.Players:GetPlayerFromCharacter(script.Parent)
game.Players:GetPlayerFromCharacter(script.Parent).Camera.CameraSubject = newChar.Humanoid
game.Players:GetPlayerFromCharacter(script.Parent):LoadCharacter()
end
end

3 comments
That is my initial thought process. It probably is flawed.
Thanks, but this happened: https://i.gyazo.com/ac79a313a1239c5ffe8d317905956ae0.mp4 . The camera does not lock to the player, and the clothes do not load;;;
Ohhh, I see. Hmmm, what about this, set
Camera.CameraTypetoCustomand save the initial character's Shirt and Pants and apply those to your clone character. I hope this helps!