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

Why Don't My Attacks Work?

Asked by 4 years ago
Edited 4 years ago

I'm working on a fighting game and i'm tryna code attacks, for some reason, the attack doesn't deal any damage,

ATK1 (LocalScript)

01local ContextActionService = game:GetService("ContextActionService")
02local plr = game.Players.LocalPlayer
03local function ATK1(actionName, inputState, inputObject)
04    if plr.Team == game.Teams.Lobby then
05        print("not attacking :D")
06    else
07    if inputState == Enum.UserInputState.Begin then
08        if plr.ATK1.Value == 1 then
09            local A = Instance.new("Animation", plr.Character)
10            A.AnimationId = "rbxassetid://5702590570" --Replace 000 with the numbers at the end of the link to your animation.
11            local track = plr.Character.Humanoid:LoadAnimation(A)
12            track:Play()
13            local hit = plr.WeakHitbox:Clone()
14            hit.Parent = plr.Character["Left Arm"]
15            plr.Character.Humanoid:UnequipTools()
View all 34 lines...

varible_insert

01local UserInputService = game:GetService("UserInputService")
02game.Players.PlayerAdded:connect(function(player)
03    local atk1 = game.ServerStorage.ATK1:Clone()
04    local atk2 = game.ServerStorage.ATK2:Clone()
05    local atk3 = game.ServerStorage.ATK3:Clone()
06    local h1 = game.ServerStorage.NormalHitbox:Clone()
07    local h2 = game.ServerStorage.StrongHitbox:Clone()
08    local h3 = game.ServerStorage.WeakHitbox:Clone()
09    atk3.Parent = player
10    atk2.Parent = player
11    atk1.Parent = player
12    h1.Parent = player
13    h2.Parent = player
14    h3.Parent = player
15end)

attack_give

01local UserInputService = game:GetService("UserInputService")
02game.Players.PlayerAdded:connect(function(player)
03    player.CharacterAdded:connect(function(char)
04        wait(0.5)
05        if player.Team == game.Teams.Lobby then
06            print("player is in the lobby, and cannot be given items")
07        else
08            if player.ATK1.Value == 1 then
09                local ATK = game.ServerStorage.ATK.Punch:Clone()
10                ATK.Parent = player.Backpack
11            end
12            if player.ATK1.Value == 2 then
13                local ATK = game.ServerStorage.ATK["Spin Arm"]:Clone()
14                ATK.Parent = player.Backpack
15            end
View all 30 lines...

WeakHitbox

1script.Parent.Touched:connect(function(hit)
2    if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
3        hit.Parent.Humanoid:TakeDamage(4)
4    end
5end)
0
Are there any erorrs? Do you have idea where the problem could be? With that info i will have more chances to find problem in your script. imKirda 4491 — 4y
0
imKirda nope, none. TheEnderG 7 — 4y

Answer this question