Script works in roblox studio but not ingame

  1. I want to make the roblox avatar blocky. Keep it simple and clear!

  2. The script works in studio but not ingame Include screenshots / videos if possible!

  3. I tried fixing it myself and looking on the dev forum Did you look for solutions on the Developer Hub?

local Players = game.Players

function PlayerJoined(Player)
	local function RemoveMeshes(Character)
		local Humanoid = Character:WaitForChild("Humanoid")
		wait()
		local CurrentDescription = Humanoid:GetAppliedDescription()

		CurrentDescription.Head = 0
		CurrentDescription.Torso = 0
		CurrentDescription.LeftArm = 0
		CurrentDescription.RightArm = 0
		CurrentDescription.LeftLeg = 0
		CurrentDescription.RightLeg = 0
		Humanoid:ApplyDescription(CurrentDescription)
	end
	Player.CharacterAdded:Connect(RemoveMeshes)
end

Players.PlayerAdded:Connect(PlayerJoined)

So the reason this sometimes doesn’t work is because the actual “CharacterAdded” event doesn’t fire. Now there are ways to fix this but there’s an easier solution

Put this in a script inside of “StarterCharacterScripts”

repeat wait() until script.Parent
local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")
wait()
local CurrentDescription = Humanoid:GetAppliedDescription()

CurrentDescription.Head = 0
CurrentDescription.Torso = 0
CurrentDescription.LeftArm = 0
CurrentDescription.RightArm = 0
CurrentDescription.LeftLeg = 0
CurrentDescription.RightLeg = 0
print("Done")
Humanoid:ApplyDescription(CurrentDescription)

If you want to keep your original script then do this

local Players = game.Players

local function RemoveMeshes(Character)
		local Humanoid = Character:WaitForChild("Humanoid")
		wait()
		local CurrentDescription = Humanoid:GetAppliedDescription()

		CurrentDescription.Head = 0
		CurrentDescription.Torso = 0
		CurrentDescription.LeftArm = 0
		CurrentDescription.RightArm = 0
		CurrentDescription.LeftLeg = 0
		CurrentDescription.RightLeg = 0
		Humanoid:ApplyDescription(CurrentDescription)
	end
function PlayerJoined(Player)
	RemoveMeshes(player.Character or player.CharacterAdded:Wait())
end

Players.PlayerAdded:Connect(PlayerJoined)

I have no idea why but it doesnt work everytime i reset it still brings me back to the original body parts, And it also prints “Done” as you added in the script

Have you tried the script I suggested inside StarterCharacterScripts?

Yes i put it in StarterCharacterScripts

I made an edit to the script, try adding it again

repeat wait() until script.Parent
local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")
wait()
local CurrentDescription = Humanoid:GetAppliedDescription()

CurrentDescription.Head = 0
CurrentDescription.Torso = 0
CurrentDescription.LeftArm = 0
CurrentDescription.RightArm = 0
CurrentDescription.LeftLeg = 0
CurrentDescription.RightLeg = 0
print("Done")
Humanoid:ApplyDescription(CurrentDescription)
1 Like

Nope the script still doesnt work

i think i found an event named CharacterAppearenceLoaded Maybe that would work

I remade the entire script to this and now it works

game.Players.PlayerAdded:Connect(function(Plr)
 Plr.CharacterAppearanceLoaded:Connect(function(Chr)
  for _,child in pairs(Chr:GetChildren()) do
   if child:IsA("CharacterMesh") then
    child:Destroy()
   end
  end
 end)
end)

local Meshes = {"Head","Torso","LeftArm","RightArm","LeftLeg","RightLeg"}

--Listen for player added
game.Players.PlayerAdded:Connect(function(Player)
	--Listen for character added
	Player.CharacterAdded:Connect(function(Character)
		--Get the humanoid and a copy of the humanoid description
		local Humanoid = Character:WaitForChild("Humanoid")
		Humanoid:WaitForChild("HumanoidDescription")
		local HumanoidDescription = Humanoid:GetAppliedDescription()
		
		--Set all the bodyparts to 0
		for _,v in Meshes do HumanoidDescription[v] = 0 end
		
		--Apply the change once the character is parented to the datamodel
		Character:GetPropertyChangedSignal("Parent"):Once(function()
			Humanoid:ApplyDescription(HumanoidDescription)
		end)
	end)
end)
1 Like

Characters can also contain MeshParts to allow them to be “unblocky” without having any CharacterMesh objects inside them, so this code will not always work.

game.Players.PlayerAdded:Connect(function(Plr)
	print("Player added")
	Plr.CharacterAppearanceLoaded:Connect(function(Chr)
		print("Apperance loaded")
		for _,child in pairs(Chr:GetChildren()) do
			if child:IsA("CharacterMesh") then
				print("Character Mesh Destroyed")
				child:Destroy()
			end
		end
	end)
end)

So sometimes it can glitch out?

It will sometimes not work as players can infact be unblocky without having any character meshes inside of them, the code I posted should avoid that issue.

Your script doesnt work now too and it prints an error??

Mind telling me the outputted error?

Humanoid::ApplyDescription() DataModel was not available - Server - Script:17

Weird. Tell me if this code works

local Meshes = {"Head","Torso","LeftArm","RightArm","LeftLeg","RightLeg"}

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		local Humanoid = Character:WaitForChild("Humanoid")
		Humanoid:WaitForChild("HumanoidDescription")
		local HumanoidDescription = Humanoid:GetAppliedDescription()
		
		for _,v in Meshes do HumanoidDescription[v] = 0 end
		
		local Connection = nil
		Connection = Character:GetPropertyChangedSignal("Parent"):Connect(function()
			if Character.Parent then
				Connection:Disconnect()
				Humanoid:ApplyDescription(HumanoidDescription)
			end
		end)
	end)
end)

Nope the code doesnt work i think im going to stick to the other code

Not sure why it wont work, sorry for bothering

local Enumeration = Enum
local Game = game
local Players = Game:GetService("Players")

local function Default(Humanoid, HumanoidDescription)
	for _, BodyPart in ipairs(Enumeration.BodyPart:GetEnumItems()) do
		HumanoidDescription[BodyPart.Name] = 0
	end
	Humanoid:ApplyDescription(HumanoidDescription)
end

local function OnPlayerAdded(Player)
	local function OnCharacterAdded(Character)
		if not (Player:HasAppearanceLoaded()) then Player.CharacterAppearanceLoaded:Wait() end
		local Humanoid = Character:FindFirstChild("Humanoid") or Character:WaitForChild("Humanoid", 10)
		if not Humanoid then return end
		local HumanoidDescription = Humanoid:GetAppliedDescription()
		task.defer(Default, Humanoid, HumanoidDescription)
	end
	
	Player.CharacterAdded:Connect(OnCharacterAdded)
end

Players.PlayerAdded:Connect(OnPlayerAdded)

This works.