Im trying to do a prison script and i dont want to let people get out of there so i did this , but it doesn't even work well only "running" is printed
print("running")
script.Parent.Folder.ChildAdded:Connect(function(c)
print("child")
wait(0.5)
local cname = c.Name
print(cname)
if c:IsA("StringValue") then
while wait(3) do
if script.Parent:FindFirstChild(cname) then
print("yes")
workspace[cname].Torso.CFrame = CFrame.new(script.Parent.Parent.SpawnLocation.Position)
else
print("broke")
break
end
end
end
end)

1 comment
Try this: run the game, once you see "running" has been printed out go to the folder that you included in the second line of code add a part by right clicking or something. If the rest of the script don't work then comment here.