I have the following code:
f1.ClickDetector.MouseClick:connect(function()
if base.Position.Y > 0 then
repeat
base.CFrame = base.CFrame - Vector3.new(0, .1, 0)
f1.CFrame = f1.CFrame - Vector3.new(0, .1, 0)
f2.CFrame = f2.CFrame - Vector3.new(0, .1, 0)
f3.CFrame = f3.CFrame - Vector3.new(0, .1, 0)
f4.CFrame = f4.CFrame - Vector3.new(0, .1, 0)
wait(.1)
until base.Position.Y <= 0
else end
end)
f2.ClickDetector.MouseClick:connect(function()
if base.Position.Y > 10 then
repeat
base.CFrame = base.CFrame - Vector3.new(0, .1, 0)
f1.CFrame = f1.CFrame - Vector3.new(0, .1, 0)
f2.CFrame = f2.CFrame - Vector3.new(0, .1, 0)
f3.CFrame = f3.CFrame - Vector3.new(0, .1, 0)
f4.CFrame = f4.CFrame - Vector3.new(0, .1, 0)
wait()
until base.Position.Y <= 10
elseif base.Position.Y < 10 then
repeat
base.CFrame = base.CFrame + Vector3.new(0, .1, 0)
f1.CFrame = f1.CFrame + Vector3.new(0, .1, 0)
f2.CFrame = f2.CFrame + Vector3.new(0, .1, 0)
f3.CFrame = f3.CFrame + Vector3.new(0, .1, 0)
f4.CFrame = f4.CFrame + Vector3.new(0, .1, 0)
print(base.Position.Y)
wait()
until base.Position.Y >= 10
else end
end)
However, neither performs the operation I want with accuracy. Instead of simply .1, the code adds something like .100000000001789. Why is this? Can someone explain to me why this is happening, and a possible solution? Thanks.
