Hello all,
I am making a fishing system like from stardew valley. Basically though I just need help with using :TweenPosition()
and getting the time to change depending on where the moving gui is. e.g. if the green bar is near the top you will go the same amount time as if it would go from the start. After looking around you can use the time = distance/speed formula but thats not working or maybe i’m not doing it right.
local speed = 0.2
press.MouseButton1Down:Connect(function()
local scale = max.Position.Y.Scale - min.Position.Y.Scale * -1
local toTop = scale - gbar.Position.Y.Scale --- distance between greenbar to the top
local toBottom = scale - (scale - gbar.Position.Y.Scale) --- distance between greenbar to the bottom
local Time1 = (toTop)/speed
local Time2 = (toBottom)/speed
gbar:TweenPosition(max.Position, Enum.EasingDirection.In, Enum.EasingStyle.Linear, Time1, true)
print(Time1)
press.MouseButton1Up:Connect(function()
print(Time2)
gbar:TweenPosition(min.Position, Enum.EasingDirection.In, Enum.EasingStyle.Linear, Time1, true)
end)
end)
robloxapp-20230715-1759198.wmv (396.0 KB)
Thanks