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
I'm not really sure about this one, but maybe try cloning your character, change the clone's humanoid's RigType
to R6, set the its Position
to the current character's position, parent the clone character to the workspace, and set player.Character
to the clone character, then :Destroy()
the current character.
I found this article that might help; good luck! https://devforum.roblox.com/t/how-can-i-change-the-character-to-another-character/368670/13
the cloning idea is halfway there, have you considered LoadCharacter()
? that sounds like what you need.