Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How i can script punch that can be in starter pack?

i want punch with changeable damage. nothing else

8 comments

0

Let me try it dood.

0

this is not a request site. we only help you with code, we can't make you code.

0

I make it. Idk why the people can't help in to create a code? What is the problem?

0

@Foxy_Developer Most times they just copy and ignore anything you written in the code, and only looks to the code if it errors

0

Yeah, you are right. That the why I explain it first. If they only copy and paste well... They're dumb. Bc there's someone helping them to be a beter scripter and theu ignore him.

0

Well im not that dumb. i read EVERYTHING but i never understand everything, but this means learning i think?

0

Yeah, thanks for read the explanaiton it tooks me 8min to write all,

0

If they copy and paste the code that menas that you wasted your time

1 answer

✓ Accepted answer

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!

13 comments

0

Okay but i have the next problem. where i must put in the scripts?

0

Sorry for it, im a complete vegetable with scripting but i want to start with something. Really appreciate it. :D

0

Put in into the Punch Animation Script that you already have, And that's all! Please accept my answer if it solved your question!

0

But i dont have any of scripts of punch animation. i dont know is it local script or script and where to put it

0

Sight, first you have to make a Animation Script so the animation will run when the player press any key or do something. Then you create a Script int the AnimationScript and you put the chunk of code I made into the Script. And that's all.

0

But where i must put it, ServerStorage?, Server\

0

Okay. i did the 2 scripts. but there are on workspace. i dont know where to put them that they will work

0

You can put them on RS or SS [ReplicatedStorage or ServerStorage] even you can put them in ServerScriptService!

0

They arent working, so i must did something wrong. next is that they must be script, local script, or module script?

0

The AnimationScript have to be a LocalScript, and the Damage a nomal Script.

0

Welp dont work but thanks for help anyway

0

Search any tutorial on Youtube. Or you can also add me on discord [Username : Sharky_Dev, Tag : #7032]

0

Added

This discussion is preserved as it was. New answers, comments, and votes are closed.