Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Could someone help me make my attack script stop damageing?

Asked by 7 years ago
Edited 7 years ago

Here is the script its not the best but it my try at it im kinda in experienced

This is my full script i tried my best

01local animation = Instance.new("Animation")
02 
03    animation.AnimationId = "http://www.roblox.com/Asset?id=873178948"
04    Player = game.Players.LocalPlayer
05 mouse = Player:GetMouse()
06 
07local Player = game.Players.LocalPlayer
08 
09local Character = Player.Character
10 
11local Humanoid = Character:WaitForChild("Humanoid")
12 
13local Animation = Instance.new("Animation")
14 
15function Hit(damage)
View all 40 lines...
0
messy thread , please organise it properly. arshad145 392 — 7y
0
k CaptainJ222 2 — 7y
0
Why do you define "CanDamage" twice? User#5423 17 — 7y
View all comments (8 more)
0
thank you CaptainJ222 2 — 7y
0
I didn't know the site had that :o Thank you for the information ^^ arshad145 392 — 7y
0
lol CaptainJ222 2 — 7y
0
@CaptainJ222 the problem is the way you are using / creating the CanDamage variable. User#5423 17 — 7y
0
please explain CaptainJ222 2 — 7y
0
Where are you connecting the "Hit" function? User#5423 17 — 7y
0
oh umm CaptainJ222 2 — 7y
0
dosnt function Hit(damage) CaptainJ222 2 — 7y

1 answer

Log in to vote
1
Answered by
arshad145 392 Moderation Voter
7 years ago

Hello,

I have tried to help as far as I can because your script is a mess.

Localscript found in Backpack :

01local animation = Instance.new("Animation")
02animation.AnimationId = "rbxassetid://873178948" --Convert it into an assetid by putting it into a AnimationId slot.
03local player = game.Players.LocalPlayer
04local mouse = player:GetMouse()
05--local Character = Player.Character -- In studio , everything loads nearly instantly, but on servers there is a delay.
06repeat wait() until player.Character -- This creates a loop until the player has fully loaded.
07local char = player.Character
08local hum = char:findFirstChild("Humanoid")
09local animTrack = nil
10local CanDamage = true -- Why do you declare both as false and true?
11--The above is a debounce , which prevents the instant death of a Humanoid.
12 
13 
14mouse.KeyDown:connect(function(key)
15    if key:lower() == "q" then
View all 30 lines...

I am still learning RbxLua.

Thank you for reading.

0
Thankyou for trying with my messy work im new a well CaptainJ222 2 — 7y
0
unfortunatly it only dose damage once men this is hard idk why it wont work CaptainJ222 2 — 7y
0
It will do damage after 1 second...Cooldown just change line 24 : wait(delay you want) arshad145 392 — 7y
Ad

Answer this question