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

Kill script doesn't work with a cloned part?

Asked by 5 years ago
Edited 5 years ago
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)


0
What does the clone script look like, not sure there is enough information provided to help you. ForeverBrown 356 — 5y
0
you were in client mode? Donut792 216 — 5y
0
Yes Gameplay28 139 — 5y

Answer this question