I’m trying to make a barrier tool you can place around and since I’m not good at scripting I looked up a video to help and I kept watching over the video and cant figure out why it worked for him and not for me.
Warnings:
Code around warnings:
https://gyazo.com/8d1e3572ea61dfd8c09aede8226c3a09
2 Likes
Avcd_o
(Avo)
July 16, 2021, 5:59pm
#2
Did you previously define the variables earlier in the script (outside of any loops or functions) by doing
local <VariableName>
? if you didn’t, then the script is trying to read and set an undefined variable that you didn’t establish before.
This is what I have the tutorial did not add anything for the ev, ev1, or ev2
1 Like
Avcd_o
(Avo)
July 16, 2021, 6:02pm
#4
The tutorial may have been outdated, however I believe that just pre-defining the variables at the start of the script should solve the issue. Alternatively, you could just make the variables local within the function the first time you defined each of them.
Consider reading this for more info.
W003 on the valid was fixed but it pops up errors or becomes a W001 problem when I did it to the ev. I’m going to keep trying with it for a minute.
If I fix the W003 and W001 I get an error.
Avcd_o
(Avo)
July 16, 2021, 6:17pm
#7
May I see what the lines causing the errors are?
When I fix the warnings for one then a . causes an error:
1 Like
Avcd_o
(Avo)
July 16, 2021, 6:19pm
#9
Ah, one of the issues is that you’re doing ev.Disconnect()
and not ev:Disconnect()
And for ev1/ev2 fixing the warnings cause the parenthesis to error
1 Like
When I fixed the . to a colon the parenthesis errored for ev aswell.
Avcd_o
(Avo)
July 16, 2021, 6:22pm
#12
When you hover over the red underlines, what do they say?
Syntax error: Incomplete statement: expected assignment or function call.
Avcd_o
(Avo)
July 16, 2021, 6:26pm
#14
You don’t need to put local before the variables when you do the disconnect. You only need to add the local part the first time you define them.
Avcd_o
(Avo)
July 16, 2021, 6:32pm
#16
Yes, and try replacing
local ev = <YourFunction>
with
local ev
ev = <YourFunction>
, making sure to have them on separate lines.
1 Like
Thank you. That cleared the warning and errors.