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

Help With This Script Please?

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

1 comment

0

What exactly are you trying to do?

1 answer

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.

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