I want to make a frame that loads to stop at a specific position. When it reaches that position, I want it to wait 3 secs and then destroy the frames (there are 2 frames. 1 is named scroll and another is named backscroll).
In the output it says "then" expected near "=".
for i = 0,100,1 do script.Parent.Scroll.Size = UDim2.new(0, i*16, 0, 40) wait(math.random(0.08,0.80)) end if script.Parent.Scroll.Size = UDim2.new(0, 400, 0, 40) then wait (3) script.Parent.Scroll.Size:Destroy() end
The reason your getting that error is because your trying to set a value inside of a if statement, when you mean to be comparing them.
Instead of > = use > == which compares instead of trying to set.
Trying to set:
if script.Parent.Scroll.Size = UDim2.new(0, 400, 0, 40) then
Comparing:
if script.Parent.Scroll.Size == UDim2.new(0, 400, 0, 40) then
Instead of using a for loop, Roblox now has the Tweening method, I won't go into details about as the wiki page does a better job of it.
You will want to read about the tween size in the article to help achieve what your doing, but reading about Tween Position will help understand it too.
On line 5, you only put one equals sign (=). When comparing variables, you use two (==). So, the argument on line 5 should be script.Parent.Scroll.Size == UDim2.new(0, 400, 0, 40)
. You use 1 equals sign (=) to set variables.
Please upvote and accept!
EDIT: You might want to use Tweening. The other person who answered your question gave you a link. There should be plenty of examples on the wiki.
Locked by AmericanStripes
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?