Question:
i was trying to do a simple variable system. But i don’t know how to set my variable! I already tried “setVar()” but it was invalid, am new at coding in Lua.
local MyVariable
if MyVariable == 9
then
print("var NOT 10")
else if MyVariable == 10
then
print("var IS 10")
end
end
local MyVariable = 10 -- Assign this!
if MyVariable == 9 then -- Keep your if-thens clean
print("var NOT 10")
else if MyVariable == 10 then
print("var IS 10")
end
PS: (If this solves your problem, mark it as the solution)
Be kind and respectful. Be kind to all members and leave the community better than when you first logged on. We will not tolerate any form of bullying, hate speech, or harassment.
He/She had to say something because of YOUR actions!
So? Sounds like you just don’t want staff or mods seeing your behavior!
It seems like you are the one who was off-topic!
A good bit of us doesn’t even use Discord! And what would you even report people for?
We can discuss this further in a PM if you would like.
Why are you being so hostile to people that are just trying to help you?
Maybe if you are so upset, you should stop being mentally online and go to Burger King, the working conditions there are great I hear! I know a guy who could hook you up His name is John from BK! @FlameGrillin
@PapayaDude See the little “L3” next to the profile picture?
That means that this person has been here long enough and been helpful enough to earn it all without ever getting in trouble. The Trust Level 3s will support each other and not tolerate your harsh statements towards them.
I’m pretty sure you’re the only one that’s going to get in trouble here.
@dragonhunter1 I actually use Roblox daily and their coding language is also in Lua, so using if/else statements are no different than JavaScript if/else statements.
So, using what I’ve learned from Roblox and JavaScript, you can use the following code:
local myVariable = 10
if myVariable == 10 then
print("myVariable is 10")
else
print("myVariable is not 10")
end
Ok, thanks for the additional info, while I was reviewing scripts in Roblox Studio they were in Lua and not Luau, it’s possible that Lua is the language for scripts on objects, but luau is the language for scripting, guess Roblox is just as simple as it is!