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
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
if you clone it locally the part will only exist locally. since it's a serverscript checking when it touches, that serverscript won't ever run (since it only exists locally) User#22604 1 — 5y
0
yes User#19524 175 — 5y
0
Okay Gameplay28 139 — 5y

Answer this question