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

Why is my wait() in my script not working/ stopping the function?

Asked by 4 years ago

The wait that is not working is the one that surrounded by {{{{{{{{{{{{{{{}}}}}}}}}}}}}}}}}} Any help is appreciated

function onDied()


wait(10)

print("reee")
local x = script.Parent:FindFirstChild("Head"):Clone()
x.Anchored = true
x.CanCollide = false
x.Parent = WS
local a = script.Parent:FindFirstChild("UpperTorso"):Clone()
a.Anchored = true
a.CanCollide = false
a.Parent = WS
local p = script.Parent:FindFirstChild("LeftFoot"):Clone()
p.Anchored = true
p.CanCollide = false
p.Parent = WS
local s = script.Parent:FindFirstChild("LeftHand"):Clone()
s.Anchored = true
s.CanCollide =  false
s.Parent = WS
local o =script.Parent:FindFirstChild("LeftLowerArm"):Clone()
o.Anchored = true
o.CanCollide = false
o.Parent = WS
local l =script.Parent:FindFirstChild("LeftLowerLeg"):Clone()
l.Anchored = true
l.CanCollide = false
l.Parent = WS
local k =script.Parent:FindFirstChild("LeftUpperArm"):Clone()
k.Anchored = true
k.CanCollide = false
k.Parent = WS
local j =script.Parent:FindFirstChild("LeftUpperLeg"):Clone()
j.Anchored = true
j.CanCollide = false
j.Parent = WS
local h =script.Parent:FindFirstChild("LowerTorso"):Clone()
h.Anchored = true
h.CanCollide = false
h.Parent = WS
local g =script.Parent:FindFirstChild("RightFoot"):Clone()
g.Anchored = true
g.CanCollide = false
g.Parent = WS
local f =script.Parent:FindFirstChild("RightHand"):Clone()
f.Anchored = true
f.CanCollide = false
f.Parent = WS
local d =script.Parent:FindFirstChild("RightLowerArm"):Clone()
d.Anchored = true
d.CanCollide = false
d.Parent = WS
local m =script.Parent:FindFirstChild("RightLowerLeg"):Clone()
m.Anchored = true
m.CanCollide = false
m.Parent = WS
local n =script.Parent:FindFirstChild("RightUpperArm"):Clone()
n.Anchored = true
n.CanCollide = false
n.Parent = WS
local b =script.Parent:FindFirstChild("RightUpperLeg"):Clone()
b.Anchored = true
b.CanCollide = false
b.Parent = WS
local v =script.Parent:FindFirstChild("UpperTorso"):Clone()
v.Anchored = true
v.CanCollide = false
v.Parent = WS
local c =script.Parent:FindFirstChild("Head"):Clone()
c.Anchored = true
c.CanCollide = false
c.Parent = WS
print("meep")
{{{{{{{{{{{{{{{{{{{wait(10)}}}}}}}}}}}}}}}}}}}}}}


    game.Workspace:FindFirstChild("UpperTorso"):Destroy()
    game.Workspace:FindFirstChild("LeftFoot"):Destroy()
    game.Workspace:FindFirstChild("LeftHand"):Destroy()
    game.Workspace:FindFirstChild("LeftLowerArm"):Destroy()
    game.Workspace:FindFirstChild("LeftLowerLeg"):Destroy()
    game.Workspace:FindFirstChild("LeftUpperArm"):Destroy()
    game.Workspace:FindFirstChild("LeftUpperLeg"):Destroy()
    game.Workspace:FindFirstChild("LowerTorso"):Destroy()
    game.Workspace:FindFirstChild("RightFoot"):Destroy()
    game.Workspace:FindFirstChild("RightHand"):Destroy()
    game.Workspace:FindFirstChild("RightLowerArm"):Destroy()
    game.Workspace:FindFirstChild("RightLowerLeg"):Destroy()    
    game.Workspace:FindFirstChild("RightUpperArm"):Destroy()
    game.Workspace:FindFirstChild("RightUppperLeg"):Destroy()
    game.Workspace:FindFirstChild("UpperTorso"):Destroy()
    game.Workspace:FindFirstChild("Head"):Destroy()


end

script.Parent.Humanoid.Died:Connect(onDied)
0
Use the second parameter of FindFirstChild(), the boolean recursive. You may also need GetPlayerFromCharacter() if you want it to only affect players. DeceptiveCaster 3761 — 4y

1 answer

Log in to vote
0
Answered by
VitroxVox 884 Moderation Voter
4 years ago
Edited 4 years ago

Hello found the problem:

    game.Workspace:FindFirstChild("UpperTorso"):Destroy()
    game.Workspace:FindFirstChild("LeftFoot"):Destroy()
    game.Workspace:FindFirstChild("LeftHand"):Destroy()
    game.Workspace:FindFirstChild("LeftLowerArm"):Destroy()
    game.Workspace:FindFirstChild("LeftLowerLeg"):Destroy()
    game.Workspace:FindFirstChild("LeftUpperArm"):Destroy()
    game.Workspace:FindFirstChild("LeftUpperLeg"):Destroy()
    game.Workspace:FindFirstChild("LowerTorso"):Destroy()
    game.Workspace:FindFirstChild("RightFoot"):Destroy()
    game.Workspace:FindFirstChild("RightHand"):Destroy()
    game.Workspace:FindFirstChild("RightLowerArm"):Destroy()
    game.Workspace:FindFirstChild("RightLowerLeg"):Destroy()    
    game.Workspace:FindFirstChild("RightUpperArm"):Destroy()
    game.Workspace:FindFirstChild("RightUppperLeg"):Destroy()
    game.Workspace:FindFirstChild("UpperTorso"):Destroy()
    game.Workspace:FindFirstChild("Head"):Destroy()

You're trying to find bodyparts in the workspace, which you there's no bodyparts in the workspace unless it's a user inside the workspace which you'd need to state, you need to go inside the user then find the bodyparts example as game.Workspace["Zetruis"]:FindFirstChild("Head"):Destroy()

And ye besure to remove the {{{{{{}}}}} thing

Ad

Answer this question