Hi there. I am trying to make a game similar to that of Mining Simulator as a school project. I've gotten some features down, but I am stuck on this one.
progress.Size = UDim2.new((cursorObject.Parent:FindFirstChild("Progress").Value/cursorObject.Parent:FindFirstChild("MaxHealth").Value),0,1,0)
The one above updates the GUI anytime the progress value changes.
cursorObject.Parent.Progress.Value = cursorObject.Parent.Progress.Value + damage wait(1)
The one above is basically what is changing the value of the progress, constantly activating in a while loop, while mousebutton1 is being pressed.
Every time the GUI updates to match the progress value, it jumps to that value. This is expected. I am just wondering how would I smooth the transition out? Thank you.
If you mean nicer/prettyer, you should use :Tweensize()
. Here is a example the roblox wiki includes. It is a useful template to use so it should make it a bit easyer to change the settings.
local guiObject = script.Parent local willTween = guiObject:TweenSize( UDim2.new(0.5, 0, 0.5, 0), -- endSize (required) Enum.EasingDirection.In, -- easingDirection (default Out) Enum.EasingStyle.Sine, -- easingStyle (default Quad) 2, -- time (default: 1) true, -- should this tween override ones in-progress? (default: false) callback -- a function to call when the tween completes (default: nil) ) if willTween then print("The GuiObject will tween") else print("The GuiObject will not tween") end
If this helped you be sure to Accpet the answer so we both get rep!