local constraintTypes = {
LinearVelocity = true,
AlignPosition = true,
AlignOrientation = true
}
for Index, Velocity in pairs(Humanoid.Parent:GetDescendants()) do
if constraintTypes[Velocity.ClassName] then
end
end
“honestly, i dont want to type every type of velocity or allignment out there.”
Pretty hard to optimize one line. Possibly you could simplify the whole technique used.
Aimed at less total input needed. How well it works for you would depend on the ammout.
local velocityClasses = {
"LinearVelocity", "AngularVelocity", "AlignPosition", "AlignOrientation",
-- Any other classes needed
}
local function isVelocityClass(object)
for _, className in ipairs(velocityClasses) do
if object:IsA(className) then
return true
end
end
return false
end
-- calling class once
if isVelocityClass(velocity) then
-- code for this class
end