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

Why isn't it damaging the player when touched?

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

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) 

2 comments

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

0

I sometimes do that

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