local crop = script.Parent
local active = false
local virtualSize = 1
local actualSize = crop.Size.Y
crop.Touched:Connect(function(hit)
local character = hit.Parent
if character:FindFirstChild("Humanoid") then
print("Hum")
if character:FindFirstChildOfClass("Tool") then
if active ~= true then
if virtualSize > 0 then
active = true
print("Tool")
print(virtualSize)
if (virtualSize > 0.09) and (virtualSize < 0.11) then
print(1)
crop.Transparency = 1
crop.CanCollide = false
print(2)
end
virtualSize -= 0.1
print(virtualSize)
crop.Size = Vector3.new(crop.Size.X,actualSize * virtualSize, crop.Size.Z)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
player.leaderstats.Seeds.Value += 1
print(3)
wait(1)
active = false
print(4)
end
end
end
end
end)
while true do
if virtualSize < 1 then
if virtualSize < 0.08 then
print(5)
crop.Transparency = 0
crop.CanCollide = true
print(6)
end
virtualSize += 0.1
crop.Size = Vector3.new(crop.Size.X,actualSize * virtualSize, crop.Size.Z)
print(7)
end
wait(10)
end
this works fine until 0 for virtual size, because of roundoff errors i have to put things like
if (virtualSize > 0.09) and (virtualSize < 0.11) then
this in, but when it becomes 0, it just dies. The while loop at the bottom doesnt run and it doesnt regen. I dont know if this is because of transparency or what but the prints of 5-7 dont print when it is 0 either.