The script bugging when i do something

im making an animation game like the unknown meme animation game, and i made this script along with some other ones but in this one, if i enter a r6 rig i tried to make it r15, and it didnt spawn with clothes, and it clipped through the ground, so i put humanoiddescription stuff and it still doesnt work, and the r6 converted into r15 rig spawns a little higher but when it comes down it clips into the ground. am i doing something wrong

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UpdateRigEvent = ReplicatedStorage:WaitForChild("UpdateRig")

local function convertToR15(character)
    if character and character:IsA("Model") then
        local humanoid = character:FindFirstChildOfClass("Humanoid")
        if humanoid then
            humanoid.RigType = Enum.HumanoidRigType.R15
            local humanoidDescription = humanoid:FindFirstChildOfClass("HumanoidDescription")
            if humanoidDescription then
                humanoid:ApplyDescription(humanoidDescription)
            end
        end
    end
end

local function updateRig(username)
    local player = Players:GetUserIdFromNameAsync(username)
    if player then
        local character = Players:CreateHumanoidModelFromUserId(player)
        if character then
            local rig = workspace:FindFirstChild("Rig")
            local rigPosition = rig and rig:GetPivot() or CFrame.new(0, 0, 0)
            if rig then
                rig:Destroy()
            end
            character.Name = "Rig"
            character.Parent = workspace
            character:PivotTo(rigPosition)
            convertToR15(character)
            -- Adjust the position to ensure it's not stuck in the ground
            local rootPart = character:FindFirstChild("HumanoidRootPart")
            if rootPart then
                rootPart.CFrame = rigPosition + Vector3.new(0, 5, 0) -- Adjust the Y offset as needed
            end
        end
    end
end

UpdateRigEvent.OnServerEvent:Connect(function(player, username)
    updateRig(username)
end)

Hi there!
Do you see any errors in the output when you test this script?

no i dont, theres no error on this script or on any of the scripts related to this one

but i might have a way to fix it my just making a r6 version of it too, should i do that?

Have you tried refreshing the character?
It might help.

uh ye i did that, doesnt work, but the problem is the anim is r15 and if i spawn a r6 rig, when it converts into r15 it goes all buggy, and it still is r6

Have you checked the game settings that you have not set it to R6.
If you don’t know where, follow this step.

Home > Game Settings > Avatar > Avatar Type

ik how to set it ro r6, but the player type doesnt matter in the game

First of all, this means that the rig was can collide false and unanchored

it doesnt fully go through the ground like only its legs, not the torso

It’s probably everything except the humanoid root part is cancollide false

i just fixed it by making a stringvalue that sets to r6 or r15 depending on the rig, and from that it decides to play r6 anim version of it or r15 anim version

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.