How to Change a Roblox Humanoid’s Appearance using Lua in Roblox Studio

I broke my femur skydiving a couple of weeks ago and am still laid up in a hospital bed recovering. I’ve been meaning to start learning a little Roblox development though, so I’m using this time lying in bed at the hospital to learn Roblox game development.

The first game that I want to make is a zombie game, because I think that’d be fairly simple to create. However, I found that I’ve been having some trouble doing two things:

  1. Detecting collisions between Humanoids
  2. Changing Humanoid’s Appearance (to turn them into zombies)

This quick blog post is just going to cover topic 2, changing humanoid’s appearance. I have a little code snippet that I created tonight that changes a Humanoid’s skin color to neon green so I can represent them as zombies. If you are looking to do something similar, maybe you’ll find this code snippet useful:

local Players = game:GetService("Players")
local function alterPlayer(player)
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local userId = player.UserId
local humanoidDescription = game.Players:GetHumanoidDescriptionFromUserId(userId)
humanoidDescription.HeadColor = Color3.fromHex("#39FF14")
humanoidDescription.LeftArmColor = Color3.fromHex("#39FF14")
humanoidDescription.RightArmColor = Color3.fromHex("#39FF14")
humanoidDescription.TorsoColor = Color3.fromHex("#39FF14")
humanoidDescription.LeftLegColor = Color3.fromHex("#39FF14")
humanoidDescription.RightLegColor = Color3.fromHex("#39FF14")
if humanoid then
humanoid:ApplyDescription(humanoidDescription)
end
end
local function onPlayerAdded(player)
player.CharacterAdded:Connect(function(character)
alterPlayer(player)
end)
end
Players.PlayerAdded:Connect(onPlayerAdded)
 

topherPedersen