I am unsure what is happening here. Im pretty sure its the script.Parent.Size[axis], but how can i fix it?
local LiftCoefficient = 200
function FindArea(axis)
return script.Parent.Size.X+script.Parent.Size.Y+script.Parent.Size.Z-script.Parent.Size[axis]
end
local LookVelocity = Vector3.new(script.Parent.CFrame.LookVector.X*script.Parent.Velocity.X,script.Parent.CFrame.LookVector.Y*script.Parent.Velocity.Y,script.Parent.CFrame.LookVector.Z*script.Parent.Velocity.Z)
local Lift = math.max(FindArea("Y")*LookVelocity*LiftCoefficient,0) --bad argument #1 to 'max' (number expected, got Vector3)
Update: I modified the function, but still get same error
local LiftCoefficient = 200
function FindArea(axis)
local area = 0
if axis == "X" then
area = script.Parent.Size.Z+script.Parent.Size.Y
elseif axis == "Y" then
area = script.Parent.Size.X+script.Parent.Size.Z
elseif axis == "Z" then
area = script.Parent.Size.X+script.Parent.Size.Y
end
print(area) -- > 64
return area
end
local LookVelocity = Vector3.new(script.Parent.CFrame.LookVector.X*script.Parent.Velocity.X,script.Parent.CFrame.LookVector.Y*script.Parent.Velocity.Y,script.Parent.CFrame.LookVector.Z*script.Parent.Velocity.Z)
local Lift = math.max(FindArea("Y")*LookVelocity*LiftCoefficient,0) --bad argument #1 to 'max' (number expected, got Vector3)

3 comments
No, you don't use square brackets like that. Why do you need it?
i would like to find the property with the name equal to the same value as the axis string
actually nvm. the function actually works perfectly fine the first time, the problem was defining lift, "LookVelocity was a Vector3" and needed to be LookVelocity.Z