Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How would I go about changing a humanoid's rigtype ingame?

Asked by 3 years ago
Edited 3 years ago

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:

01_G.r6 = false
02game.Players.PlayerAdded:Connect(function(player)
03    player.Chatted:Connect(function(msg)
04        if string.lower(msg) == "/r6" then
05            _G.r6 = true
06        elseif string.lower(msg) == "/r15" then
07            _G.r6 = false
08        end
09    end)
10end)

changeRig script in startercharacterscripts:

1while wait() do
2    if _G.r6 == false and script.Parent.Parent.Parent.Humanoid.RigType == Enum.HumanoidRigType.R6 then
3        script.Parent.Parent.Parent.Humanoid.RigType = Enum.HumanoidRigType.R15
4    elseif _G.r6 == true and script.Parent.Parent.Parent.Humanoid.RigType == Enum.HumanoidRigType.R15 then
5        script.Parent.Parent.Parent.Humanoid.RigType = Enum.HumanoidRigType.R6
6    end
7end

updated:

01while wait() do
02    if _G.r6 == false and script.Parent.Humanoid.RigType == Enum.HumanoidRigType.R6 then
03        local pastChar = script.Parent
04        pastChar.Archivable = true
05        local newChar = pastChar:Clone()
06        newChar.Parent = workspace
07        newChar.Humanoid.RigType = Enum.HumanoidRigType.R15
08        local description = game.Players:GetHumanoidDescriptionFromUserId(game.Players:GetPlayerFromCharacter(script.Parent).UserId)
09        newChar.Humanoid:ApplyDescription(description)
10        repeat wait() until game.Players:GetPlayerFromCharacter(script.Parent)
11        game.Players:GetPlayerFromCharacter(script.Parent).Character = newChar
12        game.Players:GetPlayerFromCharacter(script.Parent).Camera.CameraSubject = newChar.Humanoid
13        game.Players:GetPlayerFromCharacter(script.Parent):LoadCharacter()
14    elseif _G.r6 == true and script.Parent.Humanoid.RigType == Enum.HumanoidRigType.R15 then
15        local pastChar = script.Parent
View all 27 lines...

2 answers

Log in to vote
2
Answered by 3 years ago
Edited 3 years ago

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

1
That is my initial thought process. It probably is flawed. Dehydrocapsaicin 483 — 3y
0
Thanks, but this happened: https://i.gyazo.com/ac79a313a1239c5ffe8d317905956ae0.mp4 . The camera does not lock to the player, and the clothes do not load;;; Omq_ItzJasmin 666 — 3y
1
Ohhh, I see. Hmmm, what about this, set `Camera.CameraType` to `Custom` and save the initial character's Shirt and Pants and apply those to your clone character. I hope this helps! Dehydrocapsaicin 483 — 3y
Ad
Log in to vote
0
Answered by
Speedmask 661 Moderation Voter
3 years ago

the cloning idea is halfway there, have you considered LoadCharacter()? that sounds like what you need.

0
Thank you, but I tried that and it also did not work,, I think im doing something wrong;;;i updated my question to show the script i used Omq_ItzJasmin 666 — 3y

Answer this question