i want punch with changeable damage. nothing else
Ok, lets try it!
First Step : We need to know where's our animation. And how we already script that. So first of all we need to know how to activate a animation
local animation = Instance.new("Animation") local id = 069706 animation.AnimationId = id animation:Play() wait(3) animation:Stop()
That's a easy script for play a Animation. So lets see how to make damage with the animation!
Second Step : We need to know how to use the "function()" so lets try a chunk of code! It will be easy and explained so you can undertand it!
Third Step : We need to know how to use the debounce and where we have to use it! So the animation will runs perfectly and the damage will be taked only one time per hit!
Fourth Step : Enjoy coding! You always have to enjoy what are you doing! Play some music while you script or even you can play a game before so you will be relaxed.
Lets get into the code!
--> Locals <-- local damage = 25 local debounce = false --> Code <-- local function onTouched(hit) local character = hit.Parent if character then local humanoid = character:WaitForChild("Humanoid") if humanoid then if not debounce then humanoid.Health = humanoid.Health - end end end debounce = true wait(6) --> The time you want to wait so the character will not take a lot of damage in one hit debounce = false end -->Lets connect it so it works! script.Parent:Touched:Connect(onTouched)
That's how we make a script so the character will get damage. And we add a debounce so the character will not take a lot of damage [The hit function is sensible] in one hit.
I hope my answer already solve your question. If it likes that please accept my answer. So you let me know that works for you!
Keep scripting!
Closed as Not Constructive by Leamir, firestarroblox123, and hiimgoodpack
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?