Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

TweenSize finishing faster than its desired time?

Hi there.

For some reason, when this runs, it completely skips the two seconds that the tween is supposed to be running for. it does it instantaneously. Any ideas?

mouse.Button1Down:Connect(function()
		animTrack:Play()
		stop = false
		while stop == false do
		wait()	
		for _,iore in ipairs(ore) do
			
			if cursorObject.Parent.Name == iore and magnitude <= 10 and hit == false and cursorObject.Parent.Health.Value > 0 then
				hitting = true
				hit = true
				local current = cursorObject.Parent.Name
				local currenthealth = replicatedstorge:WaitForChild("Health"):InvokeServer(current)
						
				local function executeAfter(complete)
					print("hello")
					replicatedstorge:WaitForChild("Mining"):FireServer(cursorObject,damage)
					progress.Size = UDim2.new(0,0,1,0)
					hit = false
				end
				
				local tween2 = progress:TweenSize(
					UDim2.new(1,0,1,0),
					Enum.EasingDirection.Out,
					Enum.EasingStyle.Linear,
					false,
					2,
					executeAfter
				)
				
					
			end
		end
	end	
end)

1 answer

✓ Accepted answer

Hello, FierceLeviathan.

Upon further examination of your code, one thing that definitely sticks out as an issue is that you put:

                local tween2 = progress:TweenSize(
                    UDim2.new(1,0,1,0),
                    Enum.EasingDirection.Out,
                    Enum.EasingStyle.Linear,
                    false,
                    2,
                    executeAfter
                )

The main issue here is that the parameters of TweenSize are endSize, easingDirection, easingStyle, time, override, and callback.

With that being said, your code should look more like this:

                local tween2 = progress:TweenSize(
                    UDim2.new(1,0,1,0),
                    Enum.EasingDirection.Out,
                    Enum.EasingStyle.Linear,
                    2,
                    false,
                    executeAfter
                )

Best of luck!

Source

3 comments

0

Wow. I cannot believe I missed that. Thank you so much!

0

No problem, friend.

0

Hey! Another thing, how would I go as to stop the tween when mouse.button1up occurs? Thanks again!

This discussion is preserved as it was. New answers, comments, and votes are closed.