does anyone know how do to make the pet fly lower?
here is the pet script
local char = script.Parent.Parent
local hum = char:FindFirstChild(“Humanoid”)
local torso = char:FindFirstChild(“UpperTorso”)
local pet = script.Parent
local maxFloat = 1
local floatInc = 0.025
local sw = false
local fl = 0
while true do
wait()
if not sw then
fl = fl + floatInc
if fl >= maxFloat then
sw = true
end
else
fl = fl - floatInc
if fl <=-maxFloat then
sw = false
end
end
if pet ~= nil and hum ~= nil and torso ~= nil then
if hum.Health >= 0 then
local cf = torso.CFrame * CFrame.new(3,2+fl,3)
pet.BodyPosition.Position = Vector3.new(cf.x,cf.y,cf.z)
pet.BodyGyro.CFrame = torso.CFrame * CFrame.new(3,0,-3)
else
break
end
end
end
Lower the offset on the y axis for the cf declaration.
local cf = torso.CFrame * CFrame.new(3,2+fl,3)
Your 2 + fl means the pet will float 2 + whatever fl is at the given scenario.
Just lower the 2 to something like 1 or 0 because then the overall sum will always be lower than before.
Example, local cf = torso.CFrame * CFrame.new(3, .25 + fl, 3)
Because it is based off the torso which is above the ground.
You would want to subtract the height from the center of the torso to the ground. In most cases (r6) it is roughly 3 studs from the ground, therefore torso.CFrame * CFrame.new(0, -3 + fl, 0)
You may be able to use the hipheight; torso.CFrame * CFrame.new(0, -humanoid.HipHeight + fl, 0)