Hey there, developers. I have a scripting issue.
Basically, I have an R6 game, but I wan’t the characters to have a thinner body style. So I made a ‘StarterChacter’ rig!
Nice! Now all we need to do is load the players accessories and appearance and…
Erm… i’m currently baldin’ here…
I have a load character’s appearance script in StarterCharacterScripts that loads the players appearance, however the custom rig is making the accessories sink, probably because the rig is slightly taller.
So how could I fix this? This is the load character script:
local hDesc = nil
local plr = nil
while game:GetService("Players"):GetPlayerFromCharacter(script.Parent) == nil do
wait()
end
for retry = 1, 10 do
local success, result = pcall(function()
return game:GetService("Players"):GetPlayerFromCharacter(script.Parent)
end)
if success then
plr = result
break
else
task.wait(retry / 2)
end
end
while plr == nil do
wait()
end
for retry = 1, 10 do
local success, result = pcall(function()
return game:GetService("Players"):GetHumanoidDescriptionFromUserId(plr.UserId)
end)
if success then
hDesc = result
break
else
task.wait(retry / 2)
end
end
while script.Parent:FindFirstChildOfClass("Humanoid") == nil and script.Parent:FindFirstChildOfClass("Humanoid").RootPart == nil do
wait()
end
if hDesc ~= nil then
-- Remove package-related properties
hDesc.Head = 0
hDesc.Torso = 0
hDesc.LeftArm = 0
hDesc.RightArm = 0
hDesc.LeftLeg = 0
hDesc.RightLeg = 0
for retry = 1, 10 do
local success, result = pcall(function()
script.Parent:FindFirstChildOfClass("Humanoid"):ApplyDescription(hDesc)
end)
if success then
break
else
task.wait(retry / 2)
end
end
end
This is an open sourced script that I added on to so that it removes the players package (for some reason it was allowing custom packes lol)
this is the script i tried to make to fix my issue on the accessories, but no use.
local Players = game:GetService("Players")
local function liftAccessories(character)
for _, accessory in character:GetChildren() do
if accessory:IsA("Accessory") then
local handle = accessory:FindFirstChild("Handle")
if handle then
handle.CFrame = handle.CFrame * CFrame.new(0, 50, 0)
end
end
end
end
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
liftAccessories(character)
end)
end)
for _, player in Players:GetPlayers() do
if player.Character then
liftAccessories(player.Character)
end
end
Help is much appreciated!