I was working on a script for an ability, and I encountered an issue. In the script below, you will see I used script.Parent.Touched:Connect(function(t), however it didn't work. I tried the same exact script on a normal brick in workspace to see if I was crazy, and it worked. Here is my script:
--This is the damage script inside the damage part (script is disabled until activated in next script) if it helps, this is a server script.
script.Parent.Touched:Connect(function(t)
if t.Parent:FindFirstChild("Humanoid") then
t.Parent.Humanoid:TakeDamage(15)
end
end)
script 2:
--Variables may be confusing, so I will give context. (if it helps, this is a server script in serverscriptservice)
local tchfx = game.ReplicatedStorage:WaitForChild("ThunderCharge") --The damage part
local Elfx = game.ReplicatedStorage:WaitForChild("ElectricityFx") --This is just an effect for it
tch.OnServerEvent:Connect(function(p)
local c = p.Character
local hrp = c:FindFirstChild("HumanoidRootPart")
local tchfxc = tchfx:Clone()
local ElfxC = Elfx:Clone()
tchfxc.Parent = workspace -Putting damage part in workspace
hrp.Position = Vector3.new(hrp.Position.X,hrp.Position.Y * 2,hrp.Position.Z) --Putting
tchfxc.Position = Vector3.new(hrp.Position.X,hrp.Position.Y,hrp.Position.Z) --Putting character higher in air
damage part where character is
hrp.Anchored = true --Making it so character doesn't move
wait(.25)
ElfxC.Position = Vector3.new(hrp.Position.X,hrp.Position.Y,hrp.Position.Z) --Putting effects where character is
ElfxC.Parent = workspace --Putting effects in workspace
ElfxC.Script.Disabled = false --Enablingscript inside of effect
tchfxc.Dmg.Disabled = false --Enabling damage script, which should make everything it touches do some damage
end)
For even more context, Second script is a function called through client by pressing a key (that is working nicely, so that isn't part of the issue. The script DOES enable when the script runs, The parts do show up at the characters humanoidrootpart, But for some reason it does not damage.

3 comments
if you're enabling a script from a local script and that scripts job it to take damage to your humanoid, it will not work. It needs to be done on the server for it to register across the board.
it was a remote event from the client sent to the server, which then the server enabled the script.
i didnt include the client script as that part was working fine