Apply HumanoidDescription stored in ServerStorage to the Player Humanoid when clicking on a Part

Hi! I’m learning how to script and making small projects!

I want to make a script that when a Player clicks on a Part, the HumanoidDescription stored in the ServerStorage is applied to the Player Humanoid.
I don’t know what is wrong or what I need to add to make it work.

Here is the script:

local detector = script.Parent.ClickDetector
local costume = game.ServerStorage.Costume

detector.MouseClick:Connect(function(click)
	if click.Parent:FindFirstChild("Humanoid") then
		click.Parent:FindFirstChild("Humanoid"):ApplyDescription(costume)
	end
end)

Can someone help me fix the script?
Thanks! :smiley:

ClickDetector.MouseClick returns the Player who triggered the event, not a part of the character. That means you have to apply the description to click.Character:FindFirstChild("Humanoid").

1 Like

So I just need to delete .Parent?

You’d need to replace .Parent with .Character as it returns the player.

1 Like

Ohh I didn’t notice the .Character. Sorry…

@MoaufmKlo @Doqee Do you know how to make the player character go from r15 to r6 when the HumanoidDescription applies to the Player Humanoid?

Humanoid.RigType.R6/R15 is the property.

1 Like

Thank you so much for helping! :slight_smile:

I added click.Character.Humanoid.RigType.R6 = true to the script, everything else that the script is supposed to do works fine but there is an error: R6 cannot be assigned to - Server - Script:7

Humanoid.RigType = Enum.HumanoidRigType.R6/R15.

1 Like

Never mind… I don’t need more help! :slight_smile: