I need the part to damage the npcs when it is summoned but the script doesn't do anything. But when the part is in the workspace by default, it works can u pls help me SUMMONING CODE
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(input, event)
if input.KeyCode == Enum.KeyCode.Q then
local Justice = game:GetService("ReplicatedStorage").kills
wait(.0001)
local justice = Justice:Clone()
justice.Parent = game.Workspace
justice.Position = script.Parent.Parent.LowerTorso.Position - Vector3.new(0,2,0)
justice.CanCollide = false
justice.Anchored = true
script.Parent.Parent.Humanoid.WalkSpeed = 0
wait(.0001)
script.Parent.Parent.Humanoid.MaxHealth = 1000
script.Parent.Parent.Humanoid.Health = 1000
script.Parent.Parent.LowerTorso.CFrame = script.Parent.Parent.LowerTorso.CFrame + Vector3.new(0,10,0)
script.Parent.Parent.LowerTorso.Anchored = true
wait(4)
justice.jp.Enabled = true
justice.dmg.Disabled = false
justice.Transparency = 0
wait(0.5)
script.Parent.Parent.Humanoid.MaxHealth = 100
script.Parent.Parent.Humanoid.Health = 100
justice:Destroy()
script.Parent.Parent.LowerTorso.Anchored = false
script.Parent.Parent.Humanoid.WalkSpeed = 16
end
end)
DAMAGE CODE (INSIDE THE PART)
function onTouched(hit)
local human = hit.Parent:findFirstChildOfClass("Humanoid")
if (human ~= nil) then
human.Health = human.Health - 42000 -- Change the amount to change the damage.
end
end
script.Parent.Touched:connect(onTouched)

3 comments
Is your Summoning Code in a server script or LocalScript?
summoning is local
its local so that only one person gets it and not everybody because you have to equip the tool