So I have a script that checks when the Y velocity of the humanoidrootpart is below the last velocity
When printing the velocity it gives me -0.1 but when using math.floor it gives me -1. Is there any way to fix this?
local downco = (game.ReplicatedStorage.AKM.HumanoidRootPart.Hands.C0 + game.ReplicatedStorage.AKM.HumanoidRootPart.Hands.C0.UpVector * 0.4) * CFrame.Angles(math.rad(-6),0,0)
local upco = (game.ReplicatedStorage.AKM.HumanoidRootPart.Hands.C0 + game.ReplicatedStorage.AKM.HumanoidRootPart.Hands.C0.UpVector * -0.4) * CFrame.Angles(math.rad(-3),0,0)
local co = game.ReplicatedStorage.AKM.HumanoidRootPart.Hands.C0
local upbool = false
local downbool = false
local normalbool = true
------------------------------------------------------------
local currentvel = 0
game:GetService("RunService").RenderStepped:Connect(function()
print((char.HumanoidRootPart.Velocity.Y))
if math.floor(char.HumanoidRootPart.Velocity.Y) > currentvel and upbool == false then
upbool = true
downbool = false
normalbool = false
spawn(function()
for i = 5,1,-1 do
akm.HumanoidRootPart.Hands.C0 = akm.HumanoidRootPart.Hands.C0:Lerp(upco,1/5)
end
end)
elseif math.floor(char.HumanoidRootPart.Velocity.Y) < currentvel and downbool == false then
upbool = false
downbool = true
normalbool = false
spawn(function()
for i = 5,1,-1 do
akm.HumanoidRootPart.Hands.C0 = akm.HumanoidRootPart.Hands.C0:Lerp(downco,1/5)
end
end)
elseif math.floor(char.HumanoidRootPart.Velocity.Y) == 0 and normalbool == false then
upbool = false
downbool = false
normalbool = true
spawn(function()
for i = 5,1,-1 do
akm.HumanoidRootPart.Hands.C0 = akm.HumanoidRootPart.Hands.C0:Lerp(co,1/5)
end
end)
end
currentvel = (char.HumanoidRootPart.Velocity.Y)
end)