Page 1 of 1

Odd Simple Error

Posted: Sun Feb 14, 2021 8:23 pm
by DecarCC
I am having a weird but simple error in my code and I was wondering if anyone would be able to help me fix this. I'll upload my error message and the code with this post. Thanks for any help!
main.lua
(20.05 KiB) Downloaded 135 times
Error Message:
Error

Syntax error: main.lua:164: 'then' expected near '='

Traceback

[C]: at 0x7ffa33b728f0
[C]: in function 'require'
[C]: in function 'xpcall'
[C]: in function 'xpcall'

Re: Odd Simple Error

Posted: Sun Feb 14, 2021 9:23 pm
by Xii
Here is the offending code,

Code: Select all

if firetype = "Minigun" then
	baseRate = 0.75
elseif firetype = "Laser" then
	baseRate = 0.6
end
it's because you accidentally used assignment = instead of comparison == in an if statement.

Code: Select all

if firetype == "Minigun" then
	baseRate = 0.75
elseif firetype == "Laser" then
	baseRate = 0.6
end

Re: Odd Simple Error

Posted: Mon Feb 15, 2021 1:28 pm
by togFox
I still do that mistake.
Every.
Single.
Time.

Can't kill some habits.:(