Hello and thank you for taking you time to look at my question, I'll get straight to the point; My local script which is inside StarterPack and the parent of the local script is named pistol which used to be tool. I also have a part in the tool, which is pistol and the part is called Handle, and it has a mesh in it. I named all of this to see if they're causing the error. Here's the code!
01 | Player = game.Players.LocalPlayer |
02 |
03 | Gun = script.Parent |
04 |
05 | Ammo = 5 |
06 |
07 | function Shoot() |
08 |
09 | if Ammo > 0 then |
10 | Local Bullet = Instance.new( "Part" , Workspace) |
11 | Bullet.Shape = "Ball" --The Bullet is the error part. |
12 | end |
13 |
14 | end |
So the Bullet error gets a blue line under it, saying try putting local in front of Bullet to make it better. I try to put local in front of the error Bullet, but it gets an error saying 'expected '=' got 'Bullet'' I have no idea what's going on, I had to stop script production because of this error. Can you help me? If you can help me, that'll be great! Thank you and have a nice day!
Local needs to be lowercased on line 10. Try this script:
01 | Player = game.Players.LocalPlayer |
02 |
03 | Gun = script.Parent |
04 |
05 | Ammo = 5 |
06 |
07 | function Shoot() |
08 |
09 | if Ammo > 0 then |
10 | local Bullet = Instance.new( "Part" , Workspace) |
11 | Bullet.Shape = "Ball" |
12 | end |
13 |
14 | end |
Why this gave the error you described : The error showed up as 'expected "=" got "Bullet"' because it thought local was a variable. This is just like in line 1 and 3 where you used no 'local'. Capitalization counts on things like this. When you look over your script, you should notice that 'Local' is not being recognized as a keyword. Keywords are special words that cannot be used as variable names or function names, and control the flow of the script. Keywords are bolded in a dark blue color. Below are some other keywords. - if - else - elseif - for - while - break - next - not - true - false - then - end - function - local
If my answer helped you, accept and upvote it.