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

Why isn't it damaging the player when touched?

Asked by 5 years ago
Edited 5 years ago

I'm using a damage script when a object spawns depending on the mouse's location on top of a player and when it touches the enemy player it won't give me any errors nor does it gives the enemy player any damage. What i do know is that the function won't also work, when it connects with a player it won't print out any message. The damage script is also in a local script

Script:

local lightning = replicatedStorage.Lightning
locla clone = Lightning.Clone()

clone.Touched:Connect(function(h)
    print("oof")
    if h.Parent:FindFirstChild("Humanoid") and debounce then

        local enemyhumanoid = h.Parent.Humanoid
        enemyhumanoid:TakeDamage(15)

        wait(1)
    end
end)    

1 answer

Log in to vote
0
Answered by 5 years ago
local lightning = replicatedStorage.Lightning
local clone = Lightning.Clone()
--^you said locla instead of local
clone.Touched:Connect(function(h)
    print("oof")
    if h.Parent:FindFirstChild("Humanoid") and debounce then

        local enemyhumanoid = h.Parent.Humanoid
        enemyhumanoid:TakeDamage(15)

        wait(1)
    end
end) 
0
oh sry that was just a mistake when i was copy and pasting it, i didn't spell it wrong on the script sry about that paperking12 20 — 5y
0
I sometimes do that Sp1r1tD3v -4 — 5y
Ad

Answer this question