kind of self explanatory
01 | local player = game.Players.LocalPlayer |
02 | local Mouse = player:GetMouse() |
03 |
04 | game:GetService( "UserInputService" ).InputBegan:connect( function (input,proc) |
05 | if input.KeyCode = = Enum.KeyCode.N then |
06 | script.Disabled = true |
07 | local anim = Instance.new( "Animation" ) |
08 | anim.AnimationId = 'rbxassetid://865973063' |
09 | local loadanim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(anim) |
10 | loadanim:Play() |
11 | local x = Instance.new( "Part" , workspace) |
12 | x.Anchored = false |
13 | x.CanCollide = false |
14 | x.Material = "Neon" |
15 | x.Transparency = 1 |
If you want it only damage once, and only once and never again. You can create a variable so that it will only damage once. Since your script is pretty long, I will show my example;
1 | local hit = 0 -- the variable you need |
2 | local p = script.Parent |
3 |
4 | p.Touched:Connect( function (H) |
5 | if hit = 0 then -- only works if hit is 0 |
6 | hit = 1 -- hit becomes 1 so it won't damage again |
7 | -- Do damage script |
8 | end |
9 | end ) |
if you want the ball to do damage again then just make hit = 0 again at the end or leave it as 1 forever and it will never do damage EVER again.
Good Luck and Have Fun developing!