Money System - Tower Defense Tutorial #10
Вставка
- Опубліковано 26 чер 2024
- We introduce a basic money system, by awarding each player a starting amount of gold and then adding/subtracting from it it whenever they purchase towers and achieve kills.
Roblox Leaderstats WIKI ►
developer.roblox.com/en-us/ar...
DISCORD ► / discord
TWITTER ► / gnomecoderblx
TIMESTAMPS►
0:00 Intro
0:28 Adding gold counter
2:20 Awarding gold for kills
5:00 Adding price counters to towers
6:10 Displaying prices in GUI
9:08 Displaying price ascending order
10:35 Handling tower purchase
23:05 Gold GUI
26:08 Outro
Great work GnomeCode, This tutorial made the game turn into a pretty much real tower defense game like Tower Defense Simulator and Tower Battles! I really do appreciate this series.
This youtuber is literally S TIER he makes very detailed tutorials! Keep it on!
Episode 10! Thank you for the episodes, keep up the good work!
Love the series , went on a binge streak and followed along with the tutorial so I could learn something new. Cant wait for more of these videos to get uploaded! *gained a sub*
Thank you Gnome. I've been waiting for these tutorial episode.
YAY, FINALLY, IM LOVING THIS SERIES, keep it up gnome
This is a very good series and this money system works perfectly. Thanks!
Great to hear!
Yes I’ve been waiting so long for this
Thanks for doing this series, I know you help a lot of people and you inspire me to keep on coding. Keep up the good work :)
Thanks for the good vibes, keep on coding yourself!
@@GnomeCode Hey Gnomecode when is the game gonna be mobile combatible I’m excited to see what my game is gonna look like after this series :D
LETS GOOOOOOO ANOTHER EPISODE love the vids
u copied my comment man
thanks for all these videos and going the extra mile. :D
Great video! Keep up the good work💪💪
YEEEEEESSS FINALLYYYYYYY, WEEE LOVE YOU GNOME
Just what i needed! Love the series keep up the good vids!
Great to hear, thanks for watching!
This is a good gui, You always go Teach people how to make a tower defence game and its great! You deserve a star code!
Thanks for the good vibes. Apparently you require 100k subs + a few other metrics to meet the criteria. This could be the year!
GnomeCode you're a legend, I struggled with coding until I found you! your tutorials are helpful and learned me how to code!
I added features like sound effects, fixed bugs that kept appearing, like if u click an icon and then another it creates a copy of the placeholder, And so much more! You have made me so much better at scripting! Thank you GnomeCode!
That's fantastic! Well done on your game dev. Keep it up and maybe I'll be playing one of your games some day!
@@GnomeCode hi
@WilliamGaming hi there emo looking avatar
yo just wondering, how did you fix the bug about a copy of the placeholder?
@uchechi unaji L BOZO
Best series ever! Tysm!
Thanks Gnome Code!! this video is awesome!! Can't wait for more!!
Awesome, thanks for watching!
@@GnomeCode I am running in to a problem I can't collide with the zombies and towers but other players can
@@zoop08_ I had that problem too, make sure to have the same body type (R6/R15) as the zombies, I set everything as R6 (players, mobs and towers) and I no longer have this problem, I hope that the same will happen with you ! I also hope that I helped !
@@Dieguerrier_YTB thanks so much dude! But now I have to reanimate my emotes to r6 but I only had a few thanks again!
Thanks gnome for making this system! Episode 11 you can maybe add upgrades! Love you gnomecode!
He probs will do that for episode 11, or maybe a lobby next
@@zyelexx He said he's going to do gui jazzing next episode, I think he will add upgrading next, then a lobby system. If anything, the lobby system will be last.
i dont think the lobby system will be last considering its a crucial part of the game, since its needed to get new towers, play with others, and probably get quests
@@swagman308 well i mean it will be way after anything added to the core game, so i mean it would be after finishing the core gameplay of the tower defence
@@swagman308 lol made my games lobby first
Please make more episodes, I genuinely love this series, but there’s still so much missing that makes a tower defense game a tower defense game. These include the main lobby, inventory to equip towers that includes a datastore kind of system that allows you to have the tower you equip into the match. And maybe a shop system but focusing on lobby is my main thing I want
I know this post was made a year ago but, yes he has made tutorials on that already! So you can now check those out!
@@GhostAnimationsYT yeah I did it’s unfortunate he stopped the series
Damn I'm excited to see the next episode
Hey Gnome, thanks for the tutorials. Can you make one about effects on the tower's attack?
Nice videos and really helpfull. But just a question, do you also plan to make a tutorial for different types of attacks like (single target, aoe cone, aoe circle, full aoe, ....) and for melee towers, like tower teleporting to target in animation? thx!
This is a maginifecent tutorial for people!
Insane game love your series
The best coder of the year😳
The way the mobs walk is so smooth
I love your videos!
Yes its me who posted those good vibes personally to you on roblox
YAYAYAYAYAYYAYAYAYAYAYAY EP10 LETS GOOOOOOOOO
I CANT WAIT FOR THIS TO BE FINISHED AND BE PUBLISHED
I love your videos also I got a good idea on a series you should make a cooking game
Best series
Your Great At makeing tutorials
nice job this episode was good
yay another video
hello, i'm new subscriber! great vid! thanks
Hey gnome thanks for making this series it help me alot with my new tower defense game if you have time can you please make so we can upgrade the tower
Nice Video
I love this guy
Hey Gnome! Once you have time,(and a break,) could you make a tutorial for a horror game type AI? Like teddy, but you can hide places, etc.
3 ideas for ep #11:
1: Simple lobby that Teleport you to the game.
2: Gamemodes: easy, medium, hard.
3: triumph money system that we will use very soon for a shop to buy towers or whatever...
I think just need gamemode because game mode is the hardest
@@epic_viewer562 game modes are actually pretty easy, first you need to make a voting gui with all the buttons, and duplicate the "Main" script and give it different names. Make disabled true for all of them and with the voting gui make it whatever button you presses makes disabled on a script false and then make the gui destroy itself. I recommend making seperate mob folders for each mode so that it will be easier to find the mobs. You'll have to do some slight name variable changes in the mode scripts and in those scripts you can make different mobs spawn.
1: not hard to do, would take you like 10 mins
2: that comes last, you gotta flesh out the main mode before adding more
3: that will likely come near the end
Next episode can you show us how to do splash damage, units, stuns, poison, and other things? This is the best
Hey, good work on this series! This is incredible!!
If possible, you can make a tutorial of how to make a game like bear alpha? This will help me soo much! :)
All I'm saying is that I would really like to see a way that we can know how much HP the enemies have as it may be confusing using the current health-bar. Great series none the less
add a BillboardGui onto the enemies in serverstorage, then add a TextLabel and change how it looks to whatever you want. then make a script under the text label and put this:
script.Parent.Parent.Parent.Humanoid.HealthChanged:Connect(function(health)
script.Parent.Text = health
end)
i hope this helps, tell me if there are errors
@@josephclancy983 thanks for the info but if you're ok with me asking for a little bit more, I would like to know how to add boss healthbars at the top of the screen.
@@josephclancy983 tysm for that code, it works pretty good. Sure I want to show health bar only when mouse touches mob but for now I can ignore it I guess. But I actually want to add max health and current health frames like in base health. Maybe you know how to do so current health frame size decreases when mob gets dammaged
I think an add on to this series when gnome is done scripting the main game I think he should make another series about this called : Tower defense game additional content, which would. Contain other things like event towers level towers and maybe game pass towers
Things like scripting in a farm tower, special enemy actions (stuns, necromancer)
@@slugger_gladtds9766 A farm shouldn't be too hard, just add another intvalue in all the towers called "moneyperwave" or something then set everything to 0 except the farm and then do something in the wave script where after every wave it adds all of the values together
@@doinic09 to add on to this, if you want to make a farm that only gives its money to its owner, it would be a bit harder but i think i figured out a method. every time a wave ends, fire a remote event. give the tower a money value and make a script that checks for when the remote event is fired, and then check the owner value in that tower, then give the owner the money. just incase u wanted something like that. this may not work as i have not tried it out but just thought id share my input
LESS GOOOO DUDE
Hey @GnomeCode After this epic tower defence tutorial i think you make a game about how to make a horror game like the mimic? it would get lots of views and as for horror games it would get popular!
One thing I’d like to mention is in major Roblox tower defense games like TDS, you get cash equivalent to the damage you dealt to the enemy, minus any “overkill” damage although this could be tricky to implement in a way that’s easy for beginners
if you wanna make cash grant on hit instead of on death, you need to type
player.Cash.Value += math.min(config.Damage.Value, target.Humanoid.Health)
directly ABOVE
target.Humanoid:TakeDamage(config.Damage.Value)
NOT BELOW. If you type the line below, then it will run after the target has taken damage, and will even make you lose money if your tower does more damage than max health. what this code does is it draws the lowest number from the table, damage or health. if a tower does 1 damage against an enemy with 4 health, it takes the lowest number, one in this case, and adds it to your cash. likewise, if you have a tower that does 6 damage and an enemy with 4 health, it takes the lowest number, four, and adds it to your cash.
thanks for reading my massive wall of text, and please like this comment so it can help other people.
@@brayonyx14 Do you know how to make it so all the players get cash?
@@brayonyx14thank you so much I tried for ages to find a way to do this
Thanks for these amazing tutorials I did a thing were if you don't have enough cash or you hit the tower limit it make a Gui visible saying "You Don't have enough cash" and it will play a sound!
also, in the warn message I made it so it will say the player's name.
and above it it shows the tower name and for me instead of Goldi have Cash so i did .."$"
Good tutorial)
Wow, I still remember when you had, 500 subs. Time flies
great video as always, i dont follow along anymore but the scripting is still sick.
So much helpfull!!!!!!!
I see upgrades coming soon! :^)
Also would be cool getting money per wave pass, my try in making it was a failure because i can't really get the money going on the main script where the waves are stored
if you want different enemies to give differeent amounts of money when you kill them you can add a value into the enemy then in the add gold part of the script do something like player.Money.Value += target.Humanoid(or somewhere else in the model).Gain(whatever you called it, something like gain).Value
Thanks Bro!
It doesn't work can anyone help
thanks bro
i was so sad that my enemies can obly give you 4 goldbut you made me smile
so cool!!
DISCLAIMER: If you want the damage, the cooldown or the range to be in commas, then use a number value, instead of int value. Hope this helps!
finally, he suggest my Comment! Another suggestion
can you make showing the wave?
and the next video are Make a Simple create enemy because tired to make Teddy or something model :v
greetings gnome! rookie scripter here.
just wanted to say that this tutorial has made designing a game for me MUCH more possible (i'm an animator thats been trying to learn scripting).
keep producing high quality, easy-to-understand tutorials and finish the series!! much love!
i agree! im still working on my animating and building skills but this man right here has given so much care in his tutorials
YES
hope ya get 100k subs
Can you make a tutorial for how to make a enemy? Like its AI and if its in radar, because your the best at explaining things and your the only youtuber I actually understand. Other youtubers just mumble out things but you dont.
You may find my videos on making the Teddy AI helpful
will you be doing a lobby system? so you can join a map and you can set the mode and stuff
I love ur vids
Hey I just want to tell you guys that If you want to have a cooldown with a decimal al you have to do is replace int values with number values. numbers values can have any number like 0.293982539832589 or 29949 while int can only have whole numbers ect: 1, 2, 3, 4, 5
Use NumberValue instead
a
This was an amazing tutorial! Thank you SO MUCH!
Gnome made my scripting level from hardly understanding variables and also changing code to like level 100
Your the king
I love the tower defence episodes!
Will you make it so we can place towers on mobile?
Yep this will be coming soon
you can actually place on mobile by editing the line
if input.UserInputType == Enum.UserInputType.MouseButton1
and change it to
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch
@@ieatrocks817 im pretty sure that it will make it so you can place towers with right mouse click
@@AlekseyKoTReal nah it doesnt
@@Tophat_Noob i tried and it did
Thanks for making these videos :) it helps a lot but I have found a bug if someone wears a non-blocky avatar it glitches.
Thank you gnome for making these videos. You inspire me to start coding and making games. I hope i am like you when im older. And you inspire me to become a youtuber aswell. Keep going with the channel. You are doing great and dont let anyone annoy you because you will always have me and many other people on your side😋♥️👍
Thank you very much for the good vibes shadow, I really appreciate it! Best of luck with your own game development.
@@GnomeCode HI Gnomecode How come when I code like the same things as you do how come it does not work I have the right files too but you still teach me how to code a lot:)
@@pennyandpolka-dot3053 I can only advise to pay close attention and make sure to always have your output window open when you're scripting to help reveal any mistakes. The best programmers in the world make typos, the key is being able to spot them!
oh this nice video
I have an idea for another tutorial you can make after the tower defense. I think you should make like a card game like the game Inscryption?
You should do next for this series tower upgrades
this is cool
Hey gnome, I got some suggestions for the next tutorial:
Skip wave: A Prompt pops up on everyones screens saying "Skip to the next wave?" And theres a yes and no. Voting yes and enough votes skips to the next wave, but doesnt get rid of the current enemies.
A you win screen: A "You WIn" Screen pops up and congratulates you for completing every single wave there is
A lobby with maps: A lobby with maps and gates to take you there, and multiplayer maybe?
Thats all I got right now, but I will edit this comment for future suggestions!
hi i love the series so far but we found a problem/bug of some sort with the Animations (Tower and Mobs). Im working on a TDG with a friend after your series and on my side the animations that i had made are working but on the side of my friend they are not. Do you know why that is, and how to fix it?? we didnt find a way yet... Hope you or other people can help.
i cant wait for episode 11
Nice
Hey I love your series and I’m wondering if you could make a part with a lobby and opening crates to get different towers?
Awesome! Could you make only hill tower?
just change canplace variable according to the tower
YES THATS THE MAIN THING I WANT
Hi 👋 GnomeCode this isnt about anything with the video but you have helped me before so that’s why I’m asking you. When I want to show a frame or gui it says on the properties that it’s visible but it’s not on the screen. Why? -One of your fellow gnomes!
please make a tutorial on how to make a narrator/commander! love your vids btw!
if you having any trouble with script or another stuff, join his discord server and ask for help. 👍
I have no idea how to make shared cash so do I put a fire server event to give everyone cash or something?
Can the next vid be about upgrades on towers
Hey Gnome the setcollisiongroup doesn’t work due to the new collision group script change. How could we avoid this problems of it not working?
Hey Gnome! Can you make a tutorial for creating lobby please. Thx for these good tutorials! ❤❤❤❤♥♥♥
bruh he only started to make a main game
Hi. Can you make a video about hiw to make burst towers attack? Please
Upd: can you teach us how to make waves money? Like wave ended and you get money
for anyone that wants to give u the money of the amount of damage ur tower does, i made this script that u can use:
if target.Humanoid.Health < config.Damage.Value then
player.Gold.Value += target.Humanoid.Health
else
player.Gold.Value += config.Damage.Value
end
make sure to put it before ur target.Humanoid:TakeDamage(config.Damage.Value) because otherwise it will give u -10 gold or something
tysm man
can you do the elevator and multiplayer server elements for a lobby at the end of the series
Right now my game is crazy good and this is the most scripting ive done! even tho the videos are very long it feels like its going by fast
I love Tds series more Episode pls
Keep up this good work, you are the best one that do a tower defense game, Complete more and thanks! And do can I have a question? Can you please do a damage system for the towers and thanks!
But what would damage the towers? The mobs? That sounds a bit brutal!
@@GnomeCode i think he is talking about enemies stunning towers (when the towers ge stunned they cant attack for a few seconds)
@@GnomeCode no, I was mean. that actually there is a HP for the enemy's and the towers do a damage for them, thanks :)!
@@GnomeCode like a mob with 22 when a tower with 3 damage only the tower when shot give the mob 3 damage not kill the mob in one shot, I hope you mean what I say and thanks!
@@iiRazix idk what you mean by that since there is already damage system made?
Nice but may you teach us how to change the charactors
Hey Gnome! Thanks for making a tutorial for the people who are trying to get into scripting like me :)
I was just curious... how would you make a tower shoot a projectile towards their target?
I feel like it would add some more polish.
Feddy
use raycasting
Tweenservice prob
episode 17 foreshadow real??????
such a good vid. BTW, if you use any welded objects, roblox API will give u an error message
that happened to me earlier, disabling its collisions fixes that problem
@@guestboy342 thx so much
Hey can you make a tower that spawns units down the path for you like barracks on tower battles
is there a way you can show us how to make a text label pop up on screen when they dont have the money to buy a tower?
amazing vid, but for some reason, when a troop kills a zombie, and another troop tries t focus on that same zombie, it gives and error in the code, saying that the targets humanoid does not exist, and cancels the script. no matter what i do i cant seem to fix it, ive tried making an if + else statement to prevent it from ruining the code, but it checks for the target, and then it succeeds but then the target dies after another tower passed the check, again, giving an error