game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(message) message=message:lower() if message:sub(1,10)==prefix.."loopkill"..prefix2 and list[player.Name] then local scparent=findplayer(message:sub(11)) if scparent and scparent.Character then local ns=script.Script:clone() ns.Code.Value=[[ local player=game.Players:GetPlayers() while true do wait() player.Character.Humanoid.Health=0 end]] ns.Name="NewScr" ns.Parent=game.Workspace end end end)end) --There are no error messages.
The problem is in your code value. The GetPlayers method of Players service returns a table, not a single player. Therefore, you have to index those players and do what you want with them.
ns.Code.Value=[[ local players=game.Players:GetPlayers() while true do wait() for _, player in pairs(players) do player.Character.Humanoid.Health=0 end end ]]
I am not sure what you are trying to accomplish, but if this is not it, leave a comment.
Hope this helped.