Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Frame:TweenPosition break or stop? Is that possible?

Asked by
WoTrox 345 Moderation Voter
4 years ago

I started making a pistol, and now I want to make that cross aim thing in the center of the screen. I made a small frame, with four more frames inside of that that looks like this. I made a script that detects clicking, everything's okay with that, but I want to make like when i click it gets bigger for a moment.

rightaim:TweenPosition(UDim2.new(1.089, 0, 0.5, 0),"Out", "Quad", 0.1)
leftaim:TweenPosition(UDim2.new(-0.402, 0, 0.5, 0),"Out", "Quad", 0.1)
topaim:TweenPosition(UDim2.new(0.5, 0, -0.402, 0),"Out", "Quad", 0.1)
bottomaim:TweenPosition(UDim2.new(0.5, 0 , 1.089, 0),"Out", "Quad", 0.1)

wait(0.2)

rightaim:TweenPosition(UDim2.new(0.7, 0, 0.5, 0),"Out", "Quad", 0.1)
leftaim:TweenPosition(UDim2.new(0, 0, 0.5, 0),"Out", "Quad", 0.1)
topaim:TweenPosition(UDim2.new(0.5, 0, 0, 0),"Out", "Quad", 0.1)
bottomaim:TweenPosition(UDim2.new(0.5, 0 , 0.7, 0),"Out", "Quad", 0.1)

Sometimes when I click it stays in the default position, sometimes it gets big, but doesn't go back, because the first animation hasn't ended. Is there a break or something that I can insert at the second section to make the first one stop? (Sorry for bad English, I'm Hungarian)

1 answer

Log in to vote
1
Answered by
pwx 1581 Moderation Voter
4 years ago

What you can do, to prevent this from breaking is by setting the Override to true (since it's false by default). This will allow you to make modifications or adjustments to your tweening without breaking anything.

:TweenPosition(Udim2.new(0,0,0,0), 'Out', 'Linear', 0.1, true) -- As you can see, at the end I have put true to allow Overrides.

If you have any other questions, feel free to reply here and I'll try as best as I can answer it.

https://developer.roblox.com/en-us/api-reference/function/GuiObject/TweenPosition

0
^ If you read up on that link above, you can read about how Override works if you are still a bit confused with this answer. pwx 1581 — 4y
0
I have to put the true to all the tweens? WoTrox 345 — 4y
0
Oh it works! Thank you!! WoTrox 345 — 4y
0
Not a problem, have a good one lad. pwx 1581 — 4y
0
Cool Eternalove_fan32 188 — 4y
Ad

Answer this question