How do I make Y change its value when X's value is more than 10?
if x.Value == 10 then y.Value = 5 end
Make sure that you are aware of the difference between a variable and a Value
Instance
. A Value
Instance
is an actual object that you can store in the ROBLOX game hierarchy, for example, in workspace or in a Player
's Backpack
, and they have a Value
property that stores a value of a certain type. Examples are IntValue
, StringValue
, and CFrameValue
- you can read about them on the Official ROBLOX Wiki.
Now, to answer your question, there are 6 relational operators in Lua:
==
means "equal to"
~=
means "not equal to"
<
means "less than"
>
means "greater than"
<=
means "less than OR equal to"
>=
means "greater than OR equal to"
In the excerpt that you posted, ChromeNine, you used the ==
'relational operator', which means that you are checking if x is equal to 10. You want to be using >
because you want to check if x is greater than 10.
if x > 10 then y = 5 end