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

Why isnt this gui script working? Solved [closed]

Asked by
TrollD3 105
9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

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


0
Why are you asking the same question so many times? ;-; Uroxus 350 — 9y
0
ITs not the same question...... TrollD3 105 — 9y
0
if you read the last one, you would know. also this is entirely different script TrollD3 105 — 9y
0
Please make your question title relevant to your question content. It should be a one-sentence summary in question form. This is your final warning about this. AmericanStripes 610 — 9y
View all comments (4 more)
0
Why did I get a downvote? My answer answered his question, at the very least it did before he edited it. yumtaste 476 — 9y
0
what do you mean? How the heck am I supposed to ELABORATE on a question With 1 SENTENCE? TrollD3 105 — 9y
0
Make it more relevant to the question, Not just "Why isn't this working". Something like "How to make a GUI stop at specific position" Would give people more info on the question from just the title.. Uroxus 350 — 9y
0
FINE! I FIXED IT HAPPY NOW???!!!! TrollD3 105 — 9y

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?

2 answers

Log in to vote
2
Answered by 9 years ago

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.

Tweening

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.

Ad
Log in to vote
1
Answered by
yumtaste 476 Moderation Voter
9 years ago

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.

0
This answer is correct. Why am I getting a downvote? yumtaste 476 — 9y
0
my only problem is that its not stopping where i want it to stop. TrollD3 105 — 9y
0
the loading works it the stopping part that doesnt TrollD3 105 — 9y
0
The reason for that is you put the condition statement (if...then statements) outside of the for loop... yumtaste 476 — 9y