-- local function roundToDecimal(value, decimalPlaces)
local multiplier = 10^decimalPlaces
return math.floor(value * multiplier + 0.5) / multiplier
end
local function Update2(part, face, value)
local partName = part.Name
local jointInput
if partName == "Head" then
jointInput = NeckInput
elseif partName == "Torso" then
jointInput = RootJointInput
elseif partName == "Right Arm" then
jointInput = RightShoulderInput
elseif partName == "Left Arm" then
jointInput = LeftShoulderInput
elseif partName == "Right Leg" then
jointInput = RightHipInput
elseif partName == "Left Leg" then
jointInput = LeftHipInput
else
return
end
local roundedValue = roundToDecimal(value, 1)
local a = face
if a == Enum.NormalId.Front then
jointInput.PositionY.Text = tostring(-roundedValue)
elseif a == Enum.NormalId.Back then
jointInput.PositionY.Text = tostring(roundedValue)
elseif a == Enum.NormalId.Top then
jointInput.PositionZ.Text = tostring(roundedValue)
elseif a == Enum.NormalId.Bottom then
jointInput.PositionZ.Text = tostring(-roundedValue)
elseif a == Enum.NormalId.Left then
jointInput.PositionX.Text = tostring(roundedValue)
elseif a == Enum.NormalId.Right then
jointInput.PositionX.Text = tostring(-roundedValue)
end
end
local function Update1(part, axis, value)
local partName = part.Name
local jointInput
if partName == "Head" then
jointInput = NeckInput
elseif partName == "Torso" then
jointInput = RootJointInput
elseif partName == "Right Arm" then
jointInput = RightShoulderInput
elseif partName == "Left Arm" then
jointInput = LeftShoulderInput
elseif partName == "Right Leg" then
jointInput = RightHipInput
elseif partName == "Left Leg" then
jointInput = LeftHipInput
else
return
end
local roundedValue = roundToDecimal(value, 1)
if partName == "Torso" then
if axis == Enum.Axis.X then
jointInput.AnglesX.Text = tostring(-roundedValue)
elseif axis == Enum.Axis.Y then
jointInput.AnglesZ.Text = tostring(roundedValue)
elseif axis == Enum.Axis.Z then
jointInput.AnglesY.Text = tostring(roundedValue)
end
else
end
end
local LastSelected = "Torso"
local function AddThose(part)
DeleteAlr()
LastSelected = part.Name
if MuryUtilityGUI.Libs.Mode.Text == "Handles" then
local handles = Instance.new("Handles")
handles.Adornee = part
handles.Parent = Player.PlayerGui
handles.Style = Enum.HandlesStyle.Movement
handles.MouseDrag:Connect(function(axis, value)
warn("Drag")
Update2(part, axis, value)
end)
else
local arcHandles = Instance.new("ArcHandles")
arcHandles.Adornee = part
arcHandles.Parent = Player.PlayerGui
arcHandles.MouseDrag:Connect(function(axis, value)
Update1(part, axis, value)
end)
end
end
MuryUtilityGUI.Libs.Mode.Changed:Connect(function()
AddThose(AnimationPreviewCharacter[LastSelected])
end)
local function Test(Name)
AddThose(AnimationPreviewCharacter[Name])
end
local buttons = MuryUtilityGUI.Libs:GetChildren()
for _, v in pairs(buttons) do
if v:IsA("TextButton") and v.Name ~= "Mode" then
v.MouseButton1Click:Connect(function()
Test(v.Name)
end)
end
end
For somme Reasons the Axis is not the same for BaseParts I don’t know how to fix it throught.