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

Help With This Script Please? [closed]

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
function onClicked()
    if script.Parent.Parent.Parent.Parent.Bread.Value<script.Parent.Bread.Value then
        return
    end
    if script.Parent.Parent.Parent.Parent.Bread.Value>=script.Parent.Bread.Value then
        script.Parent.Parent.Parent.Parent.Cash.Value+script.Parent.Earn.Value then
    return
    end
end

it says a res line under the "+", please help also this is in a gui

0
What exactly are you trying to do? adark 5487 — 10y

Locked by BlueTaslem

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

1 answer

Log in to vote
1
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
10 years ago

You really should make variables for those very long paths. However, assuming those paths are correct, you're adding wrong. You're essentially doing this;

a = 1
b = 2
a+b

This is incorrect. When a variable is set to equal something, you must always do it with an = sign. To add something to a variable, we use the following method;

variable = variable + number

We use an equal sign to set the variable to itself, plus a number. Remember, variables will always stand for something. If we set a variable to itself, then we are just setting it to whatever it already stands for. Then we add to what the variable already stands for, and make the variable equal to that.

a = 1
b = 2
a = a + b
--Doing the same thing as,
a = 3 

A few other errors in your code, you have an extra then on line 6 that you don't need, and the return on line 8 is useless because nothing comes after that.

Ad