How to make defense system for my sword game?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? How to make stuff like armor? for my sword ga,e

  2. What solutions have you tried so far? Did you look for solutions on the Developer Hub? yes i did but i cant seem to find what i need

If my category is wrong pls correct it by mentioning down

1 Like

If you want to do armor you could change the max health. I recommend reading this

bro i want something like when a player has equipped the armor it like a item comes and plays animation and if player is holding for 15 seconds then make it unequipped and if player tries to equip it should send notifications saying you cant equip until 10 seconds and by 2 seconds the notification should go and if 10 seconds over then allow them to quip how do i do that?

thats very specific. u could try adding a debounce/deley on the equip system

I will help with the script but I won’t make the entire thing for you.

how to do that? i dont know scripting

so you know how to do all? like all which i said?

yes you can do this by doing this:

      -- code

Read this it will give you most of what you need to know

what should i write the code as?


You might want to watch some basic tutorials on scripting. Its ok that you don’t know anything we all start somewhere. But I’d rather you learn how to do it and ask for help than someone writing the script for you.

You need a tool setup and have a script in there. It would look something like this(this probably has a lot of errors and is not efficient please don’t copy this and just learn from it)
This is just unequipping it after 15 seconds

local tool = script.parent
local time = os.clock()
local humanoid = script.parent.parent.Humanoid
 time = os.clock()
     if os.clock()-time == 15 then

i dont want to learn lua i think its hard should i hire somebody for it?

Honestly It’s up to you but it can get pretty expensive to hire sometimes. So it might be better to learn.

Learning LUA is only difficult if you make it difficult. Personally I just sit down, watch scripting tutorials for fun and learn something I never knew existed or that I didn’t know before. It’s just a matter of understanding what the syntax is that proves to be difficult.

I can attempt to break down this guys code so it’s a bit easier to understand

local tool = script.parent -- This is referring to the actual tool that the player holds. You need this to connect it to a function later.

local time = os.clock() -- This variable is getting the time since called

local humanoid = script.parent.parent.Humanoid -- This is referring to the humanoid object of your players character. It holds your health, jump power, etc...

 tool.Equipped:Connect(function() -- This function is making it so when you equip your tool, the tool will automatically fire the code below
 time = os.clock() -- Getting the time since last called
     if os.clock()-time == 15 then -- Checking to see if 15 seconds has past since os.clock() was called
     Humanoid:UnequipTools() -- Makes the character forcefully unequip their tool if they currently have it equipped
     end -- closes the if statement from 'if os.clock()-time == 15 then'
end -- Ends the script once completed.

can u teach me lua? id really appreaciate it

1 Like

I unfortunately don’t have much time to teach someone something, especially over online since I have commissions open and such, but I can help lead you in the right direction instead: I’d check out these YouTubers:

TheDevKing makes pretty straight forward tutorials. I learned how to completely work processReceipt from MarketPlaceService with this guy. He has a beginner scripting series along with an advanced scripting series. I’d binge both tbh, but work your way up ofc.

AlvinBlox is a pretty good YouTuber too. He goes a little too fast at times but that’s probably just me, I never really liked the way he taught the content however he does show how to make quick games and do specific things so I would definitely tell you to consider giving AlvinBlox a try as well if TheDevKing doesn’t work out for you.

I hope this helps, and apologies.

please just teach what all are needed for this pls