function onTouched(hit) local h = hit.Parent:findFirstChild("Humanoid") while true do wait(1.5) if (h ~= nil) then h.Health = h.Health - 6 wait(1.5) end end end print("Works") script.Parent.Touched:connect(onTouched)
This script works with a normal part, however when I clone this script's parent, the clone doesn't hurt me opon touch, help?
I looked in explorer while I was testing it and the script was the child of the clone part like it should be.
Here is the clone script.
script.Parent.MouseButton1Click:Connect(function() x = game.Players.LocalPlayer:WaitForChild("PlayerGui").SurfaceGui2.TextButton.Text for i = 1, (tonumber(x)) do wait(0.2) xc = math.random(-590,-460) yc = 57 zc = math.random(-170, 60) local deathPart = game.Lighting.F9 F9C = deathPart:Clone() F9C.Parent = game.workspace deathPart.CFrame = CFrame.new(xc,yc,zc) end end)