For anyone who has a problem in Round (or around 41:04 in the video) 09:41:38.057 ServerScriptService.Main.Round:70: invalid argument #1 to 'insert' (table expected, got nil) - Server - Round:70 09:41:38.057 Stack Begin - Studio 09:41:38.057 Script 'ServerScriptService.Main.Round', Line 70 - function ProcessVote - Studio - Round:70 09:41:38.057 Stack End - Studio 09:41:38.423 Processed vote for Map - Server - Round:69 09:41:38.423 ServerScriptService.Main.Round:70: invalid argument #1 to 'insert' (table expected, got nil) (this error) Make sure your ImageButtons are properly labelled with the name of the maps (found in GameGui --> Voting --> Maps)
Instead of hard coding it to default Grassland, you can make a random selection like this, mapFolder = ServerStorage.Maps:GetChildren()[math.random(math.max(1,1), #ServerStorage.Maps:GetChildren())]
I'm at 40:51 and when i test it it give me an error that says "Argument 1 missing or nil - Server - Round:14" Can anyone help? I've also checked and everything that pertains to the voting system is the same
Can i saw your code from: table.insert(votes[vote], player.UserId) to: function round.GetWave(wave, map) becous ei maby know what happend Search for and look if your code is same as 40:16 Check you dont have another player.UserId under: table.insert(votes[vote], player.UserId
if you making your own gui and you want to make a whole table of maps so you add a list layout and see that the templates keep on going right, just click wraps true.
@@bluethedog694 Make it like tower defense simulator. Instead of making a map voter just make the main lobby with different maps where u get inside the area and get teleported to the specific map. There you can pretty much copy and paste the code but with different map and enemies.
I'm having this error which happens everytime I click a map to vote (like many others): ServerScriptService.Main.Round:74: invalid argument #1 to 'insert' (table expected, got nil) | Followed by: this error which happens 1 second after the first: Argument 1 missing or nil | I've looked through the comments, tried many different ways people have fixed it, but have had no result. Can someone help resolve this issue?
local ReplicatedStorage = game:GetService("ReplicatedStorage") local ServerStorage = game:GetService("ServerStorage") local events = ReplicatedStorage:WaitForChild("Events") local mob = require(script.Parent.Mob) local info = workspace.Info local round = {} local votes = {} function round.LoadMap() local votedMap = round.ToggleVoting() local mapFolder = ServerStorage.Maps:FindFirstChild(votedMap) if not mapFolder then mapFolder = ServerStorage.Maps.UbuyashikiHouse end
local newMap = mapFolder:Clone() newMap.Parent = workspace.Map
workspace.SpawnBox.Floor:Destroy()
newMap.Base.Humanoid.HealthChanged:Connect(function(health) if health winScore then winScore = #map winVote = name end end
return winVote end function round.ProcessVote(player, vote)
for name, mapVotes in pairs(votes) do local oldVote = table.find(mapVotes, player.UserId) if oldVote then table.remove(mapVotes, oldVote) print("Old vote found", oldVote) break end end
print("Processed vote for", vote) table.insert(votes[vote], player.UserId) end events:WaitForChild("VoteForMap").OnServerEvent:Connect(round.ProcessVote) function round.GetWave(wave, map) if wave
Hey, Theres an error in the output(my time rn is 40:52) it says: ServerScriptService.Main.Mob:49: 1 is not a valid member of Folder "Workspace.Map.Beach.Waypoints" - Server - Mob:49 line 49 of mob script says "coroutine.wrap(mob.Move)(newMob, map)" this only happens on 1 map which is annoying. thanks
for people who's voting gui wont load because the character hasnt loaded yet, wrap the round.start() in a function, and connect that function to player.CharacterAdded() inside the checking if there is a player in server .
Hey don’t know if you will respawn but he didn’t go over how to make the enemy’s spawn on the other maps and the only map it lets me spawn them on is the basic one how do I fix thsi
I'm getting a error in episode 7 saying ServerScriptService.Main.Tower:67: BodyGryo is not a valid member of Part "Workspace.Towers.SlingerNoob.HumanoidRootPart" - Server - Tower:67 can u pls help you've mad it this far...
Hey gnome code it would be cool if u made a tutorial on how u would if u add a shop gui that allows u to buy the towers U start off with starter towers And after winning a game u get money And then ur be able to buy other towers
could anyone help at 30:00 where he presses the buttopn and it prints its not coming out like when you press the button nothing happens not even a error
I’m at around 45:00, and my towers have stopped attacking. Everything else works, like gui and stuff, but my towers won’t work and it says “unable to index nil with waypoints”. Can someone please help?
@@blmsbenas6200 If I remember right you have to correct something in the gamecontroller script, but I don't remember exactly what, sorry if I couldn't help
I am having the error: invalid argument #1 to 'insert' (table expected, got nil) SOLVED!! Make sure that your are sending button.Name in the voteEvent:FireServer and not only button at 30:24. My Error was caused because I sent thorugh the button instance and not the button.Name which is a string.
You know, I'd really like you to make a final boss system, not only that, but it also has its own music and attacks that stun the towers. PD: Almost a year passed and I know a lot of things now, anyways thanks for your help!!! :)
Music is easy all you need to do is put in the music into workspace and in the round script all you need to do is game.Workspace.(Music Here).Playing = true same thing for it to no longer play just replace true with false
and a final boss system is as easy as adding an if statement for the wave it's on and making the Final boss very health-worthy. if you want more than that, then just figure it out I guess. many possibilities from the things you have learned throughout the tutorial, not gonna lie.
you could try using a similar system to how towers get targets by giving the boss a range then, you could add a bool value to the tower which marks if it's enabled or disabled if it's disabled, on the attack function tell it to wait x seconds then re-enable itself then just disable all the towers in the range of the boss
Tip for map making: don't put a border around the map like hills or something cause it can make it feel a bit claustrophobic but if you want to add them make them not too big and just put an invisible wall around the map so they don't jump onto it
I have some suggestions for some more episodes on this series: 1- coding special enemies such as summoners hidden sand mysteries, 2- coding special towers such as farms and buffing towers, 3- difficulties, 4- adding a lobby where you can go to maps and find people there instead of waiting in the game for more people.
@Jade Holdsworth the anti stun and things are what I meant when I said special towers I just gave a few examples, but thx for mentioning those so gnomecode has more clarification that they’re possible tower abilities for a video
@@SanesytpAnimation yeah kind of like the things in tds but I'm mainly looking for the coding so i can make it different but still work the same and not just be a copy of tds
Really cool tutorials. It helps me making a good tower defense game. I have some ideas for the series: 1.Towers with moving vehicle. (Like the military base) 2.tower shop 3.skins 4.support towers. (More dmg, more view, etc) That's all i can think of :P
Suggestion: Could you do badge / gamepass towers? I desperately want to make gamepass and badge towers as rewards for beating certain maps, but I don't have the know how to do it! The best I have is moving the models to replicated storage, but then everyone has access to that tower. A tutorial on the subject would be GREATLY appreciated. :)
Im waiting for this series to end so i can start can i ask one question im just wondering if u can do the thing like if theres like 5 maps and its voting can u the shuffle maps like everytime we vote for the map we will see new map Like grassland island and wasteland for first voting and for the second voting one or two on the map voting will be replaced by two new maps like iceland and Pixel island this just an example
Hey Gnomecode! there seams to be a slight issue with the targeting system atm, so say you have a bunch of low-ish hp enemies going down a path, and a high healthed enemy at the back. The towers continue to attack the first in line as its programmed to, but as soon as the high healthed enemy goes within range they all start to target that. This is the case untill the enemies that are first take a turn or reach a new waypoint, and im not really sure on what to do or how to fix it. Thanks!
I have a different but same problem. Whenever I kill a enemy with a long ranged tower if it is almost out of the range, it just pretty much targets a random enemy
I'm stuck at 41:15 Whatever i do it keep telling me ---> ServerScriptService.Main.Round:70: invalid argument #1 to 'insert' (table expected, got nil) And I don't find ANY errors inside the scripts.... So why ??? (Btw the vote countdown doesn't work either and i don't see any problems too ) FIXED : Be sure to say : local votedMap = round.ToggleVoting() ---> my error was that i've forgot to say the ()
Hmmmmmmmmmmm 0-0 I think- Player added function runs every time a player joins. Min player requirement is 3 and when more players joins after the requirement is met, that means it is going to run the function Round.Start multiple times. This would result in multiple maps being cloned and added to workspace.
anyone getting the *invalid arguement #1 to 'insert' (table expected, got nil)* error in the *ProcessVote* function, check if the game has started by adding a print just below *function Round.StartGame* - in my case, my Tower module was yielding the Main script (waiting for the map) and it wasn't firing the StartGame function
this is almost finished all i want is have a uncopylocked of the game cuz im bad at scripting after this is done will the game be uncopylocked or later?
I decided to delete the other post I made about an error. Bassically I think Gnomecode forgot to move the camera to the workspace. Bassically for anyone who is having an error with something saying Voting isn't a value of workspace.info you need to make a bool value inside it called voting
admin commands would also be cool 0_0 where you can add multiple accounts as an admin and they could cool things like give money, spawn mobs, all of that cool stuff
I Know this video is very old by now but just passing on my knowledge, if only Grassland is working and your other maps don't seem to be, make sure your "Base" model has a part named "Head"
@GnomeCode Help!! :((( On line 15 of my round script were it says local mapFolder = ServerStorage.Maps:FindFirstChild(votedMap) it say argument 1 missing or nil Can you help me?
@@HowToName559 ya know how to solve the problem ServerScriptService.Main.Round:76: invalid argument #1 to 'insert' (table expected, got nil) - Servidor - Round:76 i mean, i do it rightly
For some reason if i have 2 people in the server itll duplicate the map 2 times!!!! Is there any way to fix this pls someone help! ik you dont read comments gnome code but pls i wanna fix this so i can publish the game i made this is the only issue i have left
im getting an error for the "coroutine.wrap(tower.Attack)(newTower, player)", which says ServerScriptService.Main.Tower:221: Argument 1 missing or nil - , this error doesnt make the towers work and it doesnt remove the placeholder tower. Does anyone know how to fix this error?
i got 2 errors that say ServerScriptService.Main.Round:72: invalid argument #1 to 'insert' (table expected, got nil) and ServerScriptService.Main.Mob:32: attempt to index function with 'Start' idk how to fix these ive been trying for 3+ hours. please help nvm i fixed because in the main script in line 15 (well line 15 for me) local map = round.LoadMap didnt have the () so i added () at the end which fixed it for me i hope it works for anyone else
I would suggest that you understand what the code you are writing means (I am not trying to be rude, but learning the basics of lua is extremely helpful for writing good code). Since you have already fixed your code, I will just explain why they did not work. Here is a guide of definitions: function: Functions are basically something that returns a value, but has a wide range of uses. An example of a function of math is the linear equation (mx + b). The parameter(or whatever you put in the parenthesis) is whatever being used inside the function. You put a value of x in f(x) to find its value y in y = mx + b. nil: Nil means that it has no value or it does not exist. The first one is because when you use the table.insert function, you pass in two parameters. The three parameters I think is the table that something is being inserted in, where you are placing it in the table, and the thing that you are inserting. When the function runs, it realizes that the table parameter does not have a table in it, and prints an error. Find out why the table value is nil, and it will be fixed. In the second one, what you are doing is that you are setting the map, you want it to set to whatever is returned in the round.LoadMap function. By the way, "round" is a table, and the LoadMap function is within the table. The problem is that LoadMap and LoadMap() are two different things; and when you are calling LoadMap, it will look for a value, not the function that you set up.
I have some more ideas for this series 1- a shop for buying more towers that you can than select to use, 2- a way to unlock skins for towers like crates or something, 3- final boss health bars, 4- music and sound effects.
I think these things are pretty easy to do. Gnomecodes tutorial actually explained to me a lot of things and I was able to make my custom towers properties (hidden detection etc.) custom mobs and a shop. The shop was super easy to make actually. The boss health bars are easy to make too. I haven't done it yet but I have an idea how to do it. Basically you can put a Config folder inside the boss too like Gnomecode did with his towers. After insert a BoolValue and set it to false, name it BossSpawned whatever you want. You can call it from the round script or GameController and make a boss bar GUI that has a Tween (if you want to) and when the boss gets spawned (maybe have a script that checks if there is the Boss in the round) you can say like: if mob.config.BossSpawned then -- checks if the bool value is in the mob if mob.config.BossSpawned.Value == true then gui.BossBar.Visible = true end end if you have made a tween then you can do this if mob.config.BossSpawned then if mob.config.BossSpawned.Value == true then bossbarTween:Play() end end the boss bar you can actually make it go down every time it takes damage by taking the BillboardGui (the health of those mobs that shows up on their head) source code and changing it up a little bit. pretty sure that could work (ONE THING, IF YOU HAVE ALREADY MADE IT THEN PLEASE NAME THE LINES THE WAY YOU HAVE NAMED THEM or the way I did.) and they will work only if you have the bossbar tween or you have the boss value also, the skins are hard and im gonna test it out to see how to make them. if you see any mistakes in my explanation please tell me. Im not that good at explaining lol
Thanks for the tip, although the way my brain works is that if I think of something that might work based on my prior knowledge I need more clarification that that will work so I don’t waste time, cause I don’t have much time on my hands for coding and stuff so I don’t have the time to try something only for it to not work cause right now I only really have time to code on weekends and Fridays so I just design towers and enemies when it isn’t a day that I have time to code
in the part where you have table.insert(votes[vote], player.UserId) it creates this error for me ServerScriptService.Main.Round:69: invalid argument #1 to 'insert' (table expected, got nil) anyone know how to fix?
go to round process vote function and remove the process vote function and paste in this: function round.ProcessVote(player, vote)
for name, mapVotes in pairs(votes) do local oldVote = table.find(mapVotes, player.UserId) if oldVote then table.remove(mapVotes, oldVote) print("Old vote found", oldVote) break end end
@@kamaria2006 TYSM, however instead of events:WaitForChild("UpdateVoteCount"):FireAllClients(votes) i did events:WaitForChild("VoteForMap"):FireAllClients(votes) to get rid of the infinte yeid warning
It only shows the voting gui for one person whenever the voting gui becomes visible and it doesn't even become visible in the first place. Can someone tell me where in the video Gnome code makes a voting value in the info folder
your videos are amazing man. i started watching and following this tutorial series thinking i'd just leave it after a couple of episodes because of boredom, but this is really unlike any other scripting series. i've had tons of fun doing this. i'm only a basic scripter and have learned so much from just a tutorial series. :)
When there is less players than minimum players it says waiting for 1 player(s) at the top but the voting still shows up. How to fix? (btw the voting doesn't work when this happens but it is still there)
local Folder = game:GetService("ServerStorage"):FindFirstChild("Enemys") local Admin = {"PLRNAME"} game:GetService("Players").PlayerAdded:Connect(function(plr) if not table.find(Admin,plr.Name) then return end
plr.Chatted:Connect(function(message) local args = message:split(" ") local cmd = args[1]:lower() if cmd == "?enemy" and Folder:FindFirstChild(args[2]:lower()) then local Model = Folder:FindFirstChild(args[2]:lower()) for count = 1, args[3] do local cloned = Model:Clone(task.wait(0.5)) cloned.Name = Model.Name cloned.Parent = workspace.Enemy end end end) end)
@@KoalaKrush Where it says ServerStorage:FindFirstChild(“”). It says enemies as that is the name of their mobs folder. Replace what’s inside the brackets with what your mob folder name is.
Hey @GnomeCode! I am not sure why, but ever since I added the new maps my collision groups are no longer working. Would you know any fix? (Or anybody else also following these amazing tutorials?)
Who can fix the problem that when the map loads the voting gui doesn't go off and it keeps making polls for choosing the map every end of a round. Edit : Somehow I literally found out the bug a short while after publishing the comment. For anyone having the same problem. See if local map = round.LoadMap() is line below function round.StartGame() and not after the game is starting in ... or where you do waves.
For anyone who has a problem in Round (or around 41:04 in the video)
09:41:38.057 ServerScriptService.Main.Round:70: invalid argument #1 to 'insert' (table expected, got nil) - Server - Round:70
09:41:38.057 Stack Begin - Studio
09:41:38.057 Script 'ServerScriptService.Main.Round', Line 70 - function ProcessVote - Studio - Round:70
09:41:38.057 Stack End - Studio
09:41:38.423 Processed vote for Map - Server - Round:69
09:41:38.423 ServerScriptService.Main.Round:70: invalid argument #1 to 'insert' (table expected, got nil)
(this error)
Make sure your ImageButtons are properly labelled with the name of the maps
(found in GameGui --> Voting --> Maps)
I have a error in the local mapFolder part
Been waiting for this for ages, can be useful for so many more games too
LOVE that this came out so fast!!
great series, this really helped! thanks a lot
Glad to hear it!
went into this with NO lua experience and now i can comfortably edit the scripts on my own
amazing tutorials gnome!
Instead of hard coding it to default Grassland, you can make a random selection like this,
mapFolder = ServerStorage.Maps:GetChildren()[math.random(math.max(1,1), #ServerStorage.Maps:GetChildren())]
THANK YOU BRO I NEEDED TO FIX MY ERROR
@@Lovear-v2s the fact people still watch this series today like I am is CRAZY!!!!!!!!
@@Harv770 Yep...
@@Harv770hah
@@Harv770 you right...
Amazing again, can't wait to see the lobby creation. Also I love the new map too!
These tutorials are amazing. Do you have any plans on how to add a lobby, Shop and linked Inventory?
i think he ddoes
Keep it up bro!!! I have been watching you for a while and decided to subscribe! High quality videos!
I'm at 40:51 and when i test it it give me an error that says "Argument 1 missing or nil - Server - Round:14" Can anyone help?
I've also checked and everything that pertains to the voting system is the same
i have the same error
same
same:/
Same
Can i saw your code from: table.insert(votes[vote], player.UserId) to: function round.GetWave(wave, map) becous ei maby know what happend Search for and look if your code is same as 40:16 Check you dont have another player.UserId under: table.insert(votes[vote], player.UserId
Hey gnomecode! Can you please explain how to make a teleporter to the tower defense game from the hub!
yeah i have been waiting for it too xd
That's coming next!
@@GnomeCode Going to use the TeleportToPrivateServer() function? :) (of teleportservice)
@@GnomeCode Ok well that's nice but when (or will you) do a episode explaining how to make a inventory system for buying towers?
@@jpkrus gimme gimme gimme gimmie
if you making your own gui and you want to make a whole table of maps so you add a list layout and see that the templates keep on going right, just click wraps true.
Am I able to change the type of enemies that appear on the different maps?
I wish we could
Make another game, Model with *Blender* (I use *Photopea*), Simple!
@@Pealhaha Yeah thats what I was thinking, but if we have the map voting system then it wouldn't really work.
But he means how do you make different enemies and bosses spawn on different map.
@@bluethedog694 Make it like tower defense simulator. Instead of making a map voter just make the main lobby with different maps where u get inside the area and get teleported to the specific map. There you can pretty much copy and paste the code but with different map and enemies.
45:15 just saving my spot, best tutorials ever right here tho.
I'm having this error which happens everytime I click a map to vote (like many others): ServerScriptService.Main.Round:74: invalid argument #1 to 'insert' (table expected, got nil) | Followed by: this error which happens 1 second after the first: Argument 1 missing or nil | I've looked through the comments, tried many different ways people have fixed it, but have had no result. Can someone help resolve this issue?
same:( did u found the fix?
I am also getting this, did you fix it?
im not sure but it says that like the mapVotes isnt a table and you need the first argument to be a table which it isnt
i got same can anyone help?
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")
local events = ReplicatedStorage:WaitForChild("Events")
local mob = require(script.Parent.Mob)
local info = workspace.Info
local round = {}
local votes = {}
function round.LoadMap()
local votedMap = round.ToggleVoting()
local mapFolder = ServerStorage.Maps:FindFirstChild(votedMap)
if not mapFolder then
mapFolder = ServerStorage.Maps.UbuyashikiHouse
end
local newMap = mapFolder:Clone()
newMap.Parent = workspace.Map
workspace.SpawnBox.Floor:Destroy()
newMap.Base.Humanoid.HealthChanged:Connect(function(health)
if health winScore then
winScore = #map
winVote = name
end
end
return winVote
end
function round.ProcessVote(player, vote)
for name, mapVotes in pairs(votes) do
local oldVote = table.find(mapVotes, player.UserId)
if oldVote then
table.remove(mapVotes, oldVote)
print("Old vote found", oldVote)
break
end
end
print("Processed vote for", vote)
table.insert(votes[vote], player.UserId)
end
events:WaitForChild("VoteForMap").OnServerEvent:Connect(round.ProcessVote)
function round.GetWave(wave, map)
if wave
My tower defense can now have a multiplayer mode! Thanks for the tutorial. Helpful as always. :)
What is the name of your game?
@@Clash_Studio1 Clash of Arches
@@BBTProductionsArchive yooooo you game very cool, but very ez. If u wanna play my td here is the name (bruh tower defense(pre-alpha))
@@Clash_Studio1 thank you. The next level is going to be harder... trust me. >:)
@@BBTProductionsArchive Ok I'll wait =)
Hey,
Theres an error in the output(my time rn is 40:52)
it says:
ServerScriptService.Main.Mob:49: 1 is not a valid member of Folder "Workspace.Map.Beach.Waypoints" - Server - Mob:49
line 49 of mob script says "coroutine.wrap(mob.Move)(newMob, map)"
this only happens on 1 map which is annoying. thanks
it looks like you dont have a waypoint named 1, and the mob is confused double check your waypoints folder?
@@mogy6935 i do have one waypoint named 1
for people who's voting gui wont load because the character hasnt loaded yet, wrap the round.start() in a function, and connect that function to player.CharacterAdded() inside the checking if there is a player in server .
Hey don’t know if you will respawn but he didn’t go over how to make the enemy’s spawn on the other maps and the only map it lets me spawn them on is the basic one how do I fix thsi
Great tutorial. Keep up the good work!
I love this series, its all coming together
I'm getting a error in episode 7 saying ServerScriptService.Main.Tower:67: BodyGryo is not a valid member of Part "Workspace.Towers.SlingerNoob.HumanoidRootPart" - Server - Tower:67 can u pls help you've mad it this far...
@@jezzthedevofficial just stop spamming this in peoples comments dude, figure it out yourself
@@danniitv Be useful
@@jezzthedevofficial dont be annoying
@@danniitv I was only trying to ask for help
Hey gnomecode i found that only you the owner that cant collide with towers and mobs but other named player can how to fix that or is it just me?
I have too
Keep up the good work the main game core is already fantastic
Hey gnome code it would be cool if u made a tutorial on how u would if u add a shop gui that allows u to buy the towers
U start off with starter towers
And after winning a game u get money
And then ur be able to buy other towers
thats prob coming
When u make da,lobby u can use the gold script but make it go through the games
could anyone help at 30:00
where he presses the buttopn and it prints its not coming out
like when you press the button nothing happens not even a error
I’m at around 45:00, and my towers have stopped attacking. Everything else works, like gui and stuff, but my towers won’t work and it says “unable to index nil with waypoints”. Can someone please help?
I am sorry for replying because I don't know how to fix this problem. But did you got a fix for this?
@@Meme_Defenders have you found a fix
@@blmsbenas6200 If I remember right you have to correct something in the gamecontroller script, but I don't remember exactly what, sorry if I couldn't help
@@Meme_Defendersit’s fine i found out what it was yesterday
@@blmsbenas6200 anyone know the fix for this
I am having the error: invalid argument #1 to 'insert' (table expected, got nil)
SOLVED!! Make sure that your are sending button.Name in the voteEvent:FireServer and not only button at 30:24. My Error was caused because I sent thorugh the button instance and not the button.Name which is a string.
Could you explain this a little bit more cause i am having this same error
@@DantheBeans Inside GameController around Line 353 look for voteEvent:FireServer() ensure button.Name is placed within the ()
@@iTrulx i had done this before i got this error, and it doesn't work for me sadly
Bro tysm ik this is an old comment but still
Hey gnomecode love the series could 6ou do some new towers like farms and towers who can only be placed on certain areas like hills?
A lot of hard work,keep it up!
I have a idea
Make towers that have 2 upgrade routs maybe? Who else agrees this would be a good idea?
tower blitz moment
do it on ur own
Not really...
just no
Yeah great idea
Gnome build is back
You know, I'd really like you to make a final boss system, not only that, but it also has its own music and attacks that stun the towers.
PD: Almost a year passed and I know a lot of things now, anyways thanks for your help!!! :)
Music is easy all you need to do is put in the music into workspace and in the round script all you need to do is game.Workspace.(Music Here).Playing = true same thing for it to no longer play just replace true with false
and a final boss system is as easy as adding an if statement for the wave it's on and making the Final boss very health-worthy. if you want more than that, then just figure it out I guess. many possibilities from the things you have learned throughout the tutorial, not gonna lie.
Just say if the wave is the last wave then play the music
@@tinpothead6586 I realized that a long time ago but anyway thank you for your help
you could try using a similar system to how towers get targets by giving the boss a range
then, you could add a bool value to the tower which marks if it's enabled or disabled
if it's disabled, on the attack function tell it to wait x seconds then re-enable itself
then just disable all the towers in the range of the boss
Can we just appreciate how much work he spends on there videos
Yeah
Yeah
Yes
Yes
Yep
Suggestion: Can you make a farm tower that gives you more money each round?
This is VERY easy, you need to insert a script and make it give cash to all players whenever the info.Wave.Value changes
make a simple tower, make a function in setupGameGui where it makes the farm give money each round and make it detect the give money value too
@@wallstreetplays Why all players? it should be giving cash to only the owner of the tower right?
I can make it. It's very very easy
@GnomeCode can You help me because my towers dont attack after i did this
Tip for map making:
don't put a border around the map like hills or something cause it can make it feel a bit claustrophobic but if you want to add them make them not too big and just put an invisible wall around the map so they don't jump onto it
tf
I WAS RIGHT, WE'RE GETTING SO MANY TD VIDEOS
I have some suggestions for some more episodes on this series:
1- coding special enemies such as summoners hidden sand mysteries,
2- coding special towers such as farms and buffing towers,
3- difficulties,
4- adding a lobby where you can go to maps and find people there instead of waiting in the game for more people.
Extra one
5-towers with ability's like a airstrike or remove stun
Summoning towers would fall under 2 ( like a mil base or necromancer )
I agree with every idea here lol
@Jade Holdsworth the anti stun and things are what I meant when I said special towers I just gave a few examples, but thx for mentioning those so gnomecode has more clarification that they’re possible tower abilities for a video
like tds, cool
@@SanesytpAnimation yeah kind of like the things in tds but I'm mainly looking for the coding so i can make it different but still work the same and not just be a copy of tds
You should add a veto mode like tower battles does where it resets the maps being shown and shows different one! Maybe in another video
Yes
that could definitely be possible by using the array system that was used for switching between targeting systems
AWESOME VIDEO!!!! plz keep like this!!!
Really cool tutorials. It helps me making a good tower defense game.
I have some ideas for the series:
1.Towers with moving vehicle. (Like the military base)
2.tower shop
3.skins
4.support towers. (More dmg, more view, etc)
That's all i can think of :P
1. units in geral
3. skincrates
4. firerate
Great ideas btw
@@heitorrauberscussiato1110 thx
@@ThunderTheLazyGamer no problem :)
@@heitorrauberscussiato1110 wdym by firerate
@@crixxbrixx the time that It takes to fire
TY for pushing these vid so fast
Suggestion: Could you do badge / gamepass towers? I desperately want to make gamepass and badge towers as rewards for beating certain maps, but I don't have the know how to do it! The best I have is moving the models to replicated storage, but then everyone has access to that tower. A tutorial on the subject would be GREATLY appreciated. :)
That will most likely be done after implementing the tower store.
@@PHNX_main I'm not sure if he's doing that though, that's the thing.
bro how did i find you here 💀
Im waiting for this series to end so i can start can i ask one question im just wondering if u can do the thing like if theres like 5 maps and its voting can u the shuffle maps like everytime we vote for the map we will see new map
Like grassland island and wasteland for first voting and for the second voting one or two on the map voting will be replaced by two new maps like iceland and Pixel island this just an example
Hey Gnomecode! there seams to be a slight issue with the targeting system atm, so say you have a bunch of low-ish hp enemies going down a path, and a high healthed enemy at the back. The towers continue to attack the first in line as its programmed to, but as soon as the high healthed enemy goes within range they all start to target that. This is the case untill the enemies that are first take a turn or reach a new waypoint, and im not really sure on what to do or how to fix it. Thanks!
I have a different but same problem. Whenever I kill a enemy with a long ranged tower if it is almost out of the range, it just pretty much targets a random enemy
did you skip the mobile support episode? I'm quite sure he covered this issue in that episode
@@doinic09 did you skip the mobile support episode? I'm quite sure he covered this issue in that episode
When I test with my friends, I see the tower and enemies' animation but my friends don't
Is the game registered on you or on your group
It's only something that happens in studio, in the actual game that will not occur
if the game registered by group but you registered animations on yourself, only you will see them
make a shop and a summoner unit next and you can add an evoilve system IT WOULD BE EPIC!
I'm stuck at 41:15 Whatever i do it keep telling me ---> ServerScriptService.Main.Round:70: invalid argument #1 to 'insert' (table expected, got nil) And I don't find ANY errors inside the scripts.... So why ??? (Btw the vote countdown doesn't work either and i don't see any problems too )
FIXED : Be sure to say : local votedMap = round.ToggleVoting() ---> my error was that i've forgot to say the ()
same but i write it right
And this is the first time I’ve been here within an hour of a video being posted
Hmmmmmmmmmmm 0-0 I think-
Player added function runs every time a player joins. Min player requirement is 3 and when more players joins after the requirement is met, that means it is going to run the function Round.Start multiple times. This would result in multiple maps being cloned and added to workspace.
57:50 After i tap other acc tower icant upgrade and sell my tower what should i do?
When is Chapter 4 Speedbuild???
My health isnt setting up at 51:30
Can someone help me?
same
Lol i just finished the previous episode and this just came out :)
anyone getting the *invalid arguement #1 to 'insert' (table expected, got nil)* error in the *ProcessVote* function, check if the game has started by adding a print just below *function Round.StartGame* - in my case, my Tower module was yielding the Main script (waiting for the map) and it wasn't firing the StartGame function
make sure the map folder has the same name as the voting icon
Can you plz make a tower system so you have to buy the tower and equip it but you only have 5 tower spaces
25:12 the DisplayEndScreen(change) isnt working on mine and just shows a blue line under it please help a brother out man ;-;
Gnome, can you please add a splash tower and a summon tower before going to the lobby. If you do that, well have an idea on how to make ours
this is almost finished all i want is have a uncopylocked of the game cuz im bad at scripting after this is done will the game be uncopylocked or later?
Tbh, I recommend that the elevator is the one that actually chooses the map just like in tds, it will show the map inside the elevator.
why does the victory screen keep poping up 25:35
In my output it says ServerScriptService.Main.Mob:30: Attempt to index function with start
Hello sir I want to ask how to make a teleport system from the lobby to the game like in the original tds
I decided to delete the other post I made about an error. Bassically I think Gnomecode forgot to move the camera to the workspace. Bassically for anyone who is having an error with something saying Voting isn't a value of workspace.info you need to make a bool value inside it called voting
THANK YOU!! YOU LITTERLY JUST SAVED ME FROM NOT BEING ABLE TO CONTINUE!
that feeling when u see a bool value that u dont have in your game in the tutorial but then he removes it
if you get a problem with the info folder then you have to make a folder called Voting
where put folder?
Where to put folder?
make a BoolValue Called "Voting".
@@tomo_tomato0923
Eveything basically works but when i spawn in, it constantly dupes the same template/icon on the tower frame
h e l p
admin commands would also be cool 0_0
where you can add multiple accounts as an admin
and they could cool things like give money, spawn mobs, all of that cool stuff
thats easy just use hd admin custom commands
@@squigglesz NO EUGH
thank you so much :D you are the best teacher in the world!
Can You Help Me i Did the Tutorial And then Nothing Happens i cant do anything even the voting menu doesn't pop up D:
@@HowToDoThatYTChannel try adding print statements in each part of ur code that will help in fixing it :)
I Know this video is very old by now but just passing on my knowledge, if only Grassland is working and your other maps don't seem to be, make sure your "Base" model has a part named "Head"
My favorite youtuber at scripting now regrets
@GnomeCode Help!! :((( On line 15 of my round script were it says
local mapFolder = ServerStorage.Maps:FindFirstChild(votedMap)
it say argument 1 missing or nil
Can you help me?
same
@@Kris-fp4ys in ep.22 he fix this problems
@@HowToName559 YES, THANK YOU SO MUCH
@@HowToName559 ya know how to solve the problem ServerScriptService.Main.Round:76: invalid argument #1 to 'insert' (table expected, got nil) - Servidor - Round:76
i mean, i do it rightly
gnome can you help me if i put a tower he don't make damage help me please
Me seeing episode 1 recently talking bout path finding me checking channel again to see this
For some reason if i have 2 people in the server itll duplicate the map 2 times!!!! Is there any way to fix this pls someone help! ik you dont read comments gnome code but pls i wanna fix this so i can publish the game i made this is the only issue i have left
And how to make a badge for the killed boss?
Awesome series gnome Code i have a idea for a new series simulator games
im getting an error for the "coroutine.wrap(tower.Attack)(newTower, player)", which says ServerScriptService.Main.Tower:221: Argument 1 missing or nil - , this error doesnt make the towers work and it doesnt remove the placeholder tower. Does anyone know how to fix this error?
I have the same problem
thats cool but can you make map selecting in hub too?
hi gnome code can you make some sort of like a placement box or that towers cannot collide with path and any other models?
Can anyone help my endscreen doesn't appear when its game over only when its victory what do i do
Man, I am trying to create a Star Wars Tower Defense game (as i've never seen one before) and this is really good.
Most of the popular Star Wars games have been taken down for copyright so i would recommend for you to change your topic!
i got 2 errors that say
ServerScriptService.Main.Round:72: invalid argument #1 to 'insert' (table expected, got nil)
and
ServerScriptService.Main.Mob:32: attempt to index function with 'Start'
idk how to fix these ive been trying for 3+ hours. please help
nvm i fixed because in the main script
in line 15 (well line 15 for me)
local map = round.LoadMap
didnt have the ()
so i added () at the end which fixed it for me
i hope it works for anyone else
I would suggest that you understand what the code you are writing means (I am not trying to be rude, but learning the basics of lua is extremely helpful for writing good code). Since you have already fixed your code, I will just explain why they did not work.
Here is a guide of definitions:
function:
Functions are basically something that returns a value, but has a wide range of uses. An example of a function of math is the linear equation (mx + b). The parameter(or whatever you put in the parenthesis) is whatever being used inside the function. You put a value of x in f(x) to find its value y in y = mx + b.
nil:
Nil means that it has no value or it does not exist.
The first one is because when you use the table.insert function, you pass in two parameters. The three parameters I think is the table that something is being inserted in, where you are placing it in the table, and the thing that you are inserting. When the function runs, it realizes that the table parameter does not have a table in it, and prints an error. Find out why the table value is nil, and it will be fixed.
In the second one, what you are doing is that you are setting the map, you want it to set to whatever is returned in the round.LoadMap function. By the way, "round" is a table, and the LoadMap function is within the table. The problem is that LoadMap and LoadMap() are two different things; and when you are calling LoadMap, it will look for a value, not the function that you set up.
i fixed it@@semisixx4967
CONGRATS BRO 100K!
i HAVE BEEN WATCHING U SINCE DAY ONE :D
41:05 i got an error " argument 1 missing or nil " when i want to load any map, anyone could help me?
It happens when you don’t vote
Gnome code fixes that in the “finishing the game”
Gnome, for me the waypoints bug now help
yo bro if u end all u gonna make it uncopylocked?
I have some more ideas for this series
1- a shop for buying more towers that you can than select to use,
2- a way to unlock skins for towers like crates or something,
3- final boss health bars,
4- music and sound effects.
I think these things are pretty easy to do. Gnomecodes tutorial actually explained to me a lot of things and I was able to make my custom towers properties (hidden detection etc.) custom mobs and a shop. The shop was super easy to make actually. The boss health bars are easy to make too. I haven't done it yet but I have an idea how to do it. Basically you can put a Config folder inside the boss too like Gnomecode did with his towers. After insert a BoolValue and set it to false, name it BossSpawned whatever you want. You can call it from the round script or GameController and make a boss bar GUI that has a Tween (if you want to) and when the boss gets spawned (maybe have a script that checks if there is the Boss in the round) you can say like:
if mob.config.BossSpawned then -- checks if the bool value is in the mob
if mob.config.BossSpawned.Value == true then
gui.BossBar.Visible = true
end
end
if you have made a tween then you can do this
if mob.config.BossSpawned then
if mob.config.BossSpawned.Value == true then
bossbarTween:Play()
end
end
the boss bar you can actually make it go down every time it takes damage by taking the BillboardGui (the health of those mobs that shows up on their head) source code and changing it up a little bit.
pretty sure that could work (ONE THING, IF YOU HAVE ALREADY MADE IT THEN PLEASE NAME THE LINES THE WAY YOU HAVE NAMED THEM or the way I did.) and they will work only if you have the bossbar tween or you have the boss value
also, the skins are hard and im gonna test it out to see how to make them.
if you see any mistakes in my explanation please tell me. Im not that good at explaining lol
Thanks for the tip, although the way my brain works is that if I think of something that might work based on my prior knowledge I need more clarification that that will work so I don’t waste time, cause I don’t have much time on my hands for coding and stuff so I don’t have the time to try something only for it to not work cause right now I only really have time to code on weekends and Fridays so I just design towers and enemies when it isn’t a day that I have time to code
@@ThatDemonicGamer1 Oh alright. Well No problem for the tip, I hope it helps other people though
@@TurZ_06 can you help me make a hidden enemy and a hidden detection upgrade???
@@Averageidiot1014 sure, where can i help you with? maybe through discord its too much to type on youtube
in the part where you have
table.insert(votes[vote], player.UserId)
it creates this error for me
ServerScriptService.Main.Round:69: invalid argument #1 to 'insert' (table expected, got nil)
anyone know how to fix?
@victim_victim I did
go to round process vote function and remove the process vote function and paste in this:
function round.ProcessVote(player, vote)
for name, mapVotes in pairs(votes) do
local oldVote = table.find(mapVotes, player.UserId)
if oldVote then
table.remove(mapVotes, oldVote)
print("Old vote found", oldVote)
break
end
end
print("Processed vote for", vote)
table.insert(votes[vote], player.UserId)
events:WaitForChild("UpdateVoteCount"):FireAllClients(votes)
end
events:WaitForChild("VoteForMap").OnServerEvent:Connect(round.ProcessVote)
@@kamaria2006 TYSM, however instead of
events:WaitForChild("UpdateVoteCount"):FireAllClients(votes)
i did
events:WaitForChild("VoteForMap"):FireAllClients(votes)
to get rid of the infinte yeid warning
Dam your comment made me realise that I had to put "pairs" not "ipairs" thanks
It only shows the voting gui for one person whenever the voting gui becomes visible and it doesn't even become visible in the first place. Can someone tell me where in the video Gnome code makes a voting value in the info folder
can we play the game?
your videos are amazing man. i started watching and following this tutorial series thinking i'd just leave it after a couple of episodes because of boredom, but this is really unlike any other scripting series. i've had tons of fun doing this. i'm only a basic scripter and have learned so much from just a tutorial series. :)
I've just noticed that the kill counter only registers the kills you have gotten in that wave, not overall how do we fix this?
Are you manually setting the kills value to 0 somewhere? In my code, I only ever add to the value.
@@GnomeCode crap I've got to check that thank you
Can someone please help?I was changing the mobs a bit and when I played my game the health and wave gui were broken,I don't know how to fix it now
I fixed the wave gui but i cant manage to fix the health gui.... :(
Can someone please help me?
Who can drop the Game Controller and Round scripts
When there is less players than minimum players it says waiting for 1 player(s) at the top but the voting still shows up. How to fix? (btw the voting doesn't work when this happens but it is still there)
thats how it works i think
Gnome can please code like special story mission unlocked by killing a specific enemy unit that rarely spawns in the story game stage
Can you add a command system like : !spawn unit unitnamehere 100 and it spawns 100 of that unit?
local Folder = game:GetService("ServerStorage"):FindFirstChild("Enemys")
local Admin = {"PLRNAME"}
game:GetService("Players").PlayerAdded:Connect(function(plr)
if not table.find(Admin,plr.Name) then
return
end
plr.Chatted:Connect(function(message)
local args = message:split(" ")
local cmd = args[1]:lower()
if cmd == "?enemy" and Folder:FindFirstChild(args[2]:lower()) then
local Model = Folder:FindFirstChild(args[2]:lower())
for count = 1, args[3] do
local cloned = Model:Clone(task.wait(0.5))
cloned.Name = Model.Name
cloned.Parent = workspace.Enemy
end
end
end)
end)
@@frostx9672 omg thx so much!!!
@@frostx9672 does not work. it has an error on line 13. attempt to index nil with 'FindFirstChild'
fixed it. but nothing spawns
@@KoalaKrush Where it says ServerStorage:FindFirstChild(“”). It says enemies as that is the name of their mobs folder. Replace what’s inside the brackets with what your mob folder name is.
16:54 Just love how gnomecode deletes the GameRunning BoolValue like nothing happened lol
"You saw nothing!"
Hey @GnomeCode! I am not sure why, but ever since I added the new maps my collision groups are no longer working. Would you know any fix? (Or anybody else also following these amazing tutorials?)
Hey add a wait in your player added script
Who can fix the problem that when the map loads the voting gui doesn't go off and it keeps making polls for choosing the map every end of a round.
Edit : Somehow I literally found out the bug a short while after publishing the comment. For anyone having the same problem. See if local map = round.LoadMap() is line below function round.StartGame() and not after the game is starting in ... or where you do waves.